tailwind-extras
v2.0.2
Published
A collection of useful tailwind plugins in one package
Maintainers
Readme
Tailwind Extras 
A comprehensive collection of Tailwind CSS v4 utilities that enhance your development workflow with powerful animations, interaction states, and drag controls. Built specifically for Tailwind CSS v4's new architecture.
It plugin uses the new css-first architecture, leveraging the latest capabilities in the framework. This means utilities are provided as native CSS via @import, instead of being registered through the older JavaScript plugin API.
Features
- 🎨 Animate: Rich animation utilities for enter/exit transitions, fades, slides, zooms, and more
- 🛠️ Fully compatible with shadcn, and includes custom animations like
accordion-up,accordion-down - 🖱️ Drag: Control element draggability with semantic utility classes
- 👆 Hocus: Combined hover and focus state variants for better UX patterns
- 📜 Scrollbar: Customize scrollbar appearance with utilities for width, thumb, and track styling
Upcoming Features
- [ ] Custom utilities for
radix-uicompatibledata-,aria-, andgroup-attributes - [ ] Typography plugin for
prose
Installation & Usage
Install the package using your preferred package manager:
npm install tailwind-extrasTo include all utilities in your project, add the following to your main CSS file:
@import 'tailwindcss';
@import 'tailwind-extras';Import Individual Modules
For better bundle size control, you can import only the utilities you need:
@import 'tailwindcss';
/* Import only what you need */
@import 'tailwind-extras/animate';
@import 'tailwind-extras/drag';
@import 'tailwind-extras/hocus';
@import 'tailwind-extras/scrollbar';Plugins
Animate
Animation utilities inspired by tailwindcss-animate, optimized for Tailwind CSS v4.
Enter/Exit Animations:
<div class="animate-in fade-in slide-in-from-top duration-300">
Content entering from top
</div>
<div class="animate-out fade-out slide-out-to-bottom duration-300">
Content exiting to bottom
</div>Available Animation Types:
fade-in/fade-out- Opacity transitionszoom-in/zoom-out- Scale animationsslide-in-from-{direction}/slide-out-to-{direction}- Slide animations (top, bottom, left, right)spin-in/spin-out- Rotation animations
Animation Controls:
duration-*- Control animation durationdelay-*- Add animation delaysease-*- Customize easing functionsrepeat-*- Set iteration countdirection-*- Control animation directionfill-mode-*- Set fill mode behaviorrunning/paused- Control animation play state
Special Animations:
animate-accordion-down/animate-accordion-up- Accordion transitionsanimate-caret-blink- Text caret blinking animation
Drag
Control element draggability with semantic utility classes.
<!-- Prevent dragging -->
<img src="logo.png" class="drag-none" alt="Logo" />
<!-- Enable element dragging -->
<div class="drag-element">Draggable content</div>
<!-- Default browser drag behavior -->
<div class="drag-auto">Auto drag behavior</div>Available Classes:
drag-none- Prevents draggingdrag-element- Enables element draggingdrag-auto- Uses browser default behavior
Hocus
Combined hover and focus state variants for improved accessibility and user experience.
<!-- Combined hover and focus styles -->
<button class="hocus:bg-blue-600 hocus:text-white">
Button with :hover & :focus-visible state
</button>
<!-- Pressed state (active + hover) -->
<button class="pressed:scale-95 pressed:bg-blue-700">
Interactive button
</button>Available Variants:
hocus:- Applies styles on:focus-visible(recommended for accessibility)pressed:- Applies styles when element is both:activeand:hover
With Group and Peer:
<div class="group">
<button class="group-hocus:bg-blue-500">Button</button>
</div>
<div class="peer">
<input class="peer-hocus:border-blue-500" />
</div>Scrollbar
Customize scrollbar appearance with utilities for controlling width, thumb color, and track color.
<!-- Hide scrollbar -->
<div class="scroll-none overflow-auto">
Content with hidden scrollbar
</div>
<!-- Thin scrollbar -->
<div class="scroll-thin overflow-auto">
Content with thin scrollbar
</div>
<!-- Custom scrollbar colors -->
<div class="scroll-thumb-blue-500 scroll-track-gray-200 overflow-auto">
Content with custom colored scrollbar
</div>Available Classes:
scroll-none- Hides the scrollbar completely (cross-browser compatible)scroll-thin- Sets scrollbar width to thinscroll-thumb-{color}- Sets the scrollbar thumb color (uses Tailwind color utilities)scroll-track-{color}- Sets the scrollbar track color (uses Tailwind color utilities)
Contributing
We welcome contributions! Please review our contributing guidelines before submitting pull requests.
Development Setup
This project uses Bun.js as the primary package manager for development:
# Clone the repository
git clone https://github.com/oviirup/tailwind-extras.git
# Install dependencies
bun installWhile Bun is recommended for development, the package works with all major package managers in production.
License: MIT © Avirup Ghosh
