Transitions and Animation Utilities
You'll learn how to add smooth motion effects to your UI elements using Tailwind's transition and animation classes.
The Core Idea
Transitions make CSS property changes happen gradually instead of instantly, while animations run predefined keyframe sequences. Tailwind provides utility classes that let you apply these effects without writing custom CSS.
Think of a transition like a door slowly swinging open versus slamming—same action, smoother experience. Animations are more like choreographed dance moves that repeat or play once on command.
Transition Utilities
Tailwind's transition utilities control which properties animate and how long they take:
transition— applies smooth transitions to common properties (colors, shadows, transforms)transition-all— transitions all changing propertiestransition-colors— only transitions color-related propertiestransition-opacity— only transitions opacitytransition-transform— only transitions transforms
Duration controls speed:
duration-75,duration-150,duration-300,duration-500,duration-700,duration-1000(milliseconds)
Example:
<button class="transition duration-300 hover:scale-110">
Hover me
</button>
This button smoothly scales up over 300ms when hovered.
Animation Utilities
Tailwind includes built-in keyframe animations:
animate-spin— continuous rotation (loading spinners)animate-ping— expanding ping effect (notifications)animate-pulse— gentle fade in/out (skeleton loaders)animate-bounce— bouncing motion (attention-grabbers)
Example:
<div class="animate-spin">⟳</div>
These animations run automatically when applied—no hover or JavaScript needed.
Combining with Previous Knowledge
You can combine transitions with the transforms you learned (scale, rotate, translate) and effects like opacity or shadow to create polished interactions that feel responsive and professional.
Key Takeaway: Tailwind's transition-* and duration-* utilities smooth out property changes, while animate-* utilities apply ready-made keyframe animations—both add polish without custom CSS.