fade-in Tailwind CSS Animations
v1.0.2
79+ ready-to-use animation utilities for Tailwind CSS. Zero config, pure CSS performance.
Install and use **tailwind-animations** in this project. ## What it is CSS-only animation utilities for **Tailwind CSS v4** (79+ `animate-*` classes: fade, slide, zoom, flip, bounce, jelly, dialog entry/exit, scroll/view timelines, etc.). No JS plugin — pure CSS import. ## Install the package ```bash npm install tailwind-animations # or: pnpm add tailwind-animations / yarn add tailwind-animations ``` In the global CSS (Tailwind v4): ```css @import "tailwindcss"; @import "tailwind-animations"; ``` Peer: any Tailwind CSS v4 (`"tailwindcss": "4"`). For Tailwind v3 use legacy `@midudev/tailwind-animations@0.2.0` (deprecated). ## Usage examples ```html $ npm install tailwind-animations @import 'tailwindcss';
@import 'tailwind-animations'; Example animation utility class in use:
Animation Collection
79+ utilities. Hover to preview, click to copy.
blurred-fade-in zoom-in slide-in-top bouncing pulsing shake tada jelly flip-horizontal swing wobble rotate-360 fade-in-up slide-in-left Customize slide distance
Pair any animate-slide-* utility
with animate-slide-distance-* to
control how far it travels. Default stays 20px—no breaking change.
Hover a card (or press Replay) to compare the same slide with different distances. Direction is built into each slide utility—use a positive length or percentage.
Default
20px Built-in travel when you only use a slide utility.
animate-slide-in-right Full width
100% Slide the full element width—great for off-canvas reveals.
animate-slide-in-right animate-slide-distance-[100%] Large offset
6rem A longer entrance without writing custom keyframes.
animate-slide-in-left animate-slide-distance-[6rem] <div class="animate-slide-in-right animate-slide-distance-[100%]">
Full-width slide entrance
</div>
<div class="animate-slide-in-top animate-slide-distance-[10rem]">
Tall offset from above
</div> Scroll-Driven CSS Animations
Animate elements based on their position in the viewport using the timeline-view Tailwind utility—no JavaScript scroll listeners required.
Scroll down to see the magic
To animate elements on scroll, we use the timeline-view utility. This property creates a View Timeline that allows you to
synchronize the animation with the element's displacement within the
viewport.
The animation is automatically linked to the element's visibility
in the viewport. Use animate-range to control when the animation starts and ends relative to the element's
visibility.
timeline-view animate-zoom-in animate-range-cover
The animate-range property is essential
for defining when the animation starts and ends relative to the element's
visibility. You can use predefined ranges like gradual, moderate, brisk, or rapid to easily control the
animation's pace.
animate-range-gradual
animate-range-moderate
animate-range-brisk
animate-range-rapid
Of course, you can also use custom values for more precision. By
specifying values like entry 10% or contain 25%, you can
perfectly time the reveal effect to match your design's flow.
timeline-view animate-slide-in-left
animate-range-[entry_5%_contain_20%]
You can combine different directions and effects. Using animate-slide-in-left with a scroll timeline makes the element gracefully slide into place
while adjusting its opacity, synchronized with the user's scrolling
speed for a more interactive feel.
Blurred transitions like animate-blurred-fade-in add a layer of polish. By linking it to a scroll timeline, you create
a depth-of-field effect that naturally draws attention to the content
as it becomes clear and focused.
Scroll & View Timeline Utilities
Link Tailwind CSS animations to scroll progress or element visibility using timeline utilities for modern, scroll-driven motion.
Vertical Scroll Progress
Use timeline-scroll to link an
animation to the scroll container's progress. The animation advances
as you scroll.
↓ Scroll down to see the progress bar fill
timeline-scroll animate-expand-horizontally
Horizontal Scroll Progress
Use timeline-[scroll(inline)]
for horizontal scroll containers. The progress bar follows your horizontal
scrolling.
timeline-[scroll(inline)] animate-expand-horizontally
Entry & Exit Animation Ranges
Control when animations play with animate-range-entry (entering viewport) and animate-range-exit (leaving viewport).
↓ Scroll to see entry/exit animations
animate-range-entry
animate-range-exit
Staggered Reveal Effect
Combine timeline-view with different
animate-range
values to create a staggered reveal effect.
↓ Scroll to reveal cards in sequence
animate-range-[entry_0%_cover_30%] → [entry_10%_cover_40%] → ...
Rotation on Scroll
Use animate-rotate-360 with
animate-range-cover to rotate elements
as they pass through the viewport.
↓ Scroll to spin the shapes
animate-rotate-360
animate-spin-clockwise
animate-flip-x
Timeline Utilities Reference
Available timeline utilities and how to use them:
timeline-scroll timeline-[scroll(x)] timeline-[scroll(y)] timeline-[scroll(block)] timeline-[scroll(inline)] timeline-view timeline-[view(x)] timeline-[view(y)] timeline-[view(block)] timeline-[view(inline)] animate-range-cover animate-range-contain animate-range-entry animate-range-exit animate-range-gradual (10%-90%) animate-range-moderate (20%-80%) animate-range-brisk (30%-70%) animate-range-rapid (40%-60%) Arbitrary Values
Use brackets for custom values. Use underscores _ instead of spaces.
timeline-[scroll(x_root)] timeline-[scroll(y_nearest)] timeline-[view(block)] timeline-[view(x_200px_auto)] animate-range-[entry_0%_cover_50%] animate-range-[cover_25%_cover_75%] animate-range-[exit_-10%_exit_100%] Dialog Entry & Exit Effects
Native <dialog> elements start
from display: none. The animate-dialog utility wraps @starting-style,
display, overlay, and allow-discrete into one Tailwind
class for smooth modal open and close animations.
Add animate-dialog and style
the rest with normal Tailwind utilities.
Open the dialog and close it with the button, Escape, or by clicking the backdrop. The plugin class owns the entry and exit motion; the component markup stays native.
class="animate-dialog ..."
<button
type="button"
commandfor="motion-dialog"
command="show-modal"
>
Open dialog
</button>
<dialog
id="motion-dialog"
class="animate-dialog m-auto max-w-lg rounded-2xl bg-white p-6 shadow-2xl"
aria-labelledby="dialog-title"
>
<h2 id="dialog-title">Motion with a real dialog</h2>
<p>
One plugin class handles @starting-style, display, overlay,
the entry motion, the exit motion, and the backdrop fade.
</p>
<button
type="button"
commandfor="motion-dialog"
command="request-close"
>
Close
</button>
</dialog> Same utility, different dialog feel
Stack one motion modifier and one duration modifier on top of
animate-dialog; the rest is
still regular Tailwind styling.
from-top + fast Top drawer
A compact palette that enters from the top edge.
from-right + 500 Side panel
A settings surface that slides in horizontally.
zoom + slow Zoom confirm
A centered decision dialog with a slower scale effect.
fade + 200 Fade notice
A subtle notification dialog with almost no movement.
Frequently Asked Questions
Everything you need to know about the Tailwind CSS animations plugin.
What is tailwind-animations?
An open-source Tailwind CSS plugin that ships 79+ animation utility classes—fade, slide, zoom, bounce, flip, scroll-driven motion, and native dialog effects—so you can animate UI without writing custom keyframes.
How do I install it?
Run npm install tailwind-animations (or pnpm / yarn / bun / deno), then add @import 'tailwindcss'; and @import 'tailwind-animations'; to your global CSS for Tailwind v4.
Does it work with Tailwind CSS v3 and v4?
Yes. The current package targets Tailwind CSS v4 via CSS imports. For Tailwind v3, use the legacy package @midudev/tailwind-animations@0.2.0.
How do I use an animation utility class?
Add classes like animate-fade-in or animate-slide-in-bottom to any element. Combine them with animate-duration-*, animate-delay-*, and animate-steps-* to control timing.
Can I change how far a slide animation travels?
Yes. Pair any animate-slide-* utility with animate-slide-distance-[…] (for example animate-slide-distance-[100%] or animate-slide-distance-[10rem]). The default distance stays 20px if you omit it.
Can I build scroll-based animations?
Yes. Use timeline-view with animate-range utilities to tie CSS animations to an element position in the viewport—no scroll event listeners needed.
Is it free and open source?
Yes. The project is MIT licensed, free to use commercially, and open for contributions on GitHub at midudev/tailwind-animations.