Motion & focus

One curve, short durations, one focus ring.

Motion explains a change; it never decorates. All values come from one token scale (transitions.dev), imported once in src/styles/motion.css. Pick a token by what the motion does, never by the nearest number. Animate transform, opacity and filter only; never “transition: all”.

Durations

Click a row to play it. Closes are faster than opens.

--duration-stagger40msper-item stagger offset
--duration-micro80mstooltip / path delay, shake segment, large stagger
--duration-quick150msmodal and dropdown close, text swap, tooltip appear
--duration-fast250msicon swap, dropdown and modal open, tabs sliding, page slide, accordion
--duration-medium350mspanel close
--duration-slow400mspanel open, skeleton content reveal, input clear
--duration-very-slow500msemphasis: badge appear, text reveal, success check

Tailwind: duration-(--duration-fast)

Easings

Each row plays 500 ms so the curve is easy to see.

--ease-smooth-outcubic-bezier(0.22, 1, 0.36, 1)
the default: open and close, slide, resize, position
--ease-in-outease-in-out
icon swap, text swap, text reveal, skeleton reveal
--ease-outease-out
tooltip open / close
--ease-linearlinear
spinner
--ease-bouncecubic-bezier(0.34, 1.36, 0.64, 1)
entrances only: badge pop

Tailwind: ease-smooth-out, ease-bounce. Overshoot belongs to entrances only; never bounce a close or a hover.

Scale, distance, blur

The “pre” state a surface animates from; it always settles to rest. Bigger surfaces start further away.

--scale-large · 0.96

modal open / close

--scale-medium · 0.97

dropdown open

--distance-micro · 4px

text swap

--distance-medium · 12px

text reveal

--blur-small · 2px

panel reveal, icon / text swap, skeleton

--blur-medium · 3px

page slide, text reveal

Which component uses which recipe

ComponentRecipeValues
Dialog06 modalopen 250 · close 150 · scale .96 · backdrop fade
Sheet07 panel revealopen 400 · close 350 · slide from the right + 2px cross-blur
DropdownMenu, Select list, DateField popup05 menu dropdownopen 250 · close 150 · grows from the trigger (origin-aware)
Toast22 toastrises from below + blur · open 350 · close 250 · stays 5 s
SegmentedControl16 tabs slidingthe white pill slides 250 (symmetric)
Switch27 togglethe knob slides (a transition, so a fast second click turns it back from where it is); small overshoot inside the 4 px inset
Checkbox, ChoiceCard25 checkbox checkbox fills, then the tick draws
Field error12 error shakethe control shakes once on submit; message stays
Button loading04 text swap + 09 icon swaplabel and icon swap in place; width stays
IconButton dot, Cuti count03 notification badgedot slides on and pops from scale .5 (never from 0)
FileField upload donespinner → check morph (pro)the spinner becomes a check
Skeletons (StatTile, Table, cards)14 skeleton revealease-in-out pulse, then cross-fade + blur to content
StatTile figure36 number subtle changechanged digits cross-fade up or down
AvatarStacknoneno hover motion: hover moves nothing (the faces stay in place)
EmptyState18 texts revealtitle and line rise in with a 40 ms stagger
Accordion21 accordiongrid rows 0fr → 1fr · chevron flips · 250 symmetric

Rules

  • Open and close are not symmetric: open 250 → close 150 (dropdown, modal); panel 400 → 350. Never delay a close.
  • Symmetric motions keep one value both ways: tabs sliding, accordion, icon swap (250); text swap (150).
  • Stagger 40 ms per item; keep the total under 300 ms.
  • Reduced motion: reduce, do not delete. Travel, scale, bounce, shake and blur go away; a short 150 ms opacity fade stays on overlays, toasts and content swaps, so the eye still sees what changed. A switch knob moves at once.
  • Hover changes colour only. Nothing moves on hover (no lift, no tilt).

Focus & disabled

Keyboard focus is never removed. Use :focus-visible so a mouse click does not show the ring.

Buttons and controls

Lihat slip
outline: 2px solid var(--ring); outline-offset: 2px;

Fields

0813 2045 7781
shadow-focus = inset 0 0 0 1px var(--ring), 0 0 0 1px var(--ring) (2px on the edge, no halo)

Disabled

Kirim ke HR
--opacity-disabled 60 % (buttons, fields, switches) · --opacity-disabled-icon 40 % (icon-only)