Chapter 02 Foundations
Motion
Motion shows where something came from. Nothing over 400ms, nothing with reduced motion on.
Tokens
Three durations and one curve, quick to start and soft to land.
| Token | Value | Tailwind | For |
|---|---|---|---|
--ui-duration-fast | 150ms | duration-fast | A change in place: the switch knob. |
--ui-duration | 250ms | duration-ui | Fades: dialog, backdrop, accordion arrow. |
--ui-duration-slow | 400ms | duration-slow | Panels that travel: drawer, sheet, toast. |
--ui-ease | cubic-bezier(0.2, 0.8, 0.2, 1) | ease-ui | Every transition. Loading loops run linear at their own speed. |
Try the durations
Pick a token, then press Play: all three move at that speed.
Switch, panel and fade
Fades: dialog, backdrop, accordion arrow.
<div class="translate-x-0 transition-transform duration-ui ease-ui motion-reduce:transition-none">
Panel
</div>Animations
Ready-made entrances and feedback. Add the class when the element appears; press Replay to see each one again.
Okaapi
ui-anim-fade-inContent that appears in place.ui-anim-slide-upMenus, cards and list items entering.ui-anim-slide-downBanners and dropdowns from above.ui-anim-slide-startSide panels; flips in right-to-left.Okaapi
ui-anim-scale-inPopovers and tooltips.Okaapi
ui-anim-popConfirm a change: a badge count, a saved tick.Okaapi
ui-anim-shakeAn invalid field or a refused action.ui-anim-staggerChildren enter one after another (up to 8).ui-anim-pingA live or new indicator; loops.Okaapi
ui-anim-shimmerA loading sweep over a placeholder; loops.All of them stop under reduced motion. Loops (ping, shimmer) are for waiting, never decoration.
Rules
- Animate opacity, transform and colour; never size or position.
- Reduced motion stops everything; the spinner holds still.
- Closing never waits for an animation.