Four speeds, from smooth for websites to instant for dashboards. Components move by role, so one setting retimes all of them.
Installation#
The motion tokens, speeds and utilities ship with the foundations, which every Fabricator component installs:
bunx --bun fabricator-ui@latest add foundations
Speeds#
Fabricator UI works for marketing sites and for software people use all day, and those want different motion. Pick one of four speeds; every component follows it.
| Speed | For | Tooltip | Popup | Dialog | Popups grow from |
|---|---|---|---|---|---|
smooth | Marketing sites | 200ms | 280ms | 380ms | 0.94, slide and blur |
default | Most products | 125ms | 180ms | 250ms | 0.95 |
snappy | Apps used all day | 100ms | 140ms | 180ms | 0.97 |
instant | Dashboards, power tools | none | 80ms | 100ms | no zoom, fade only |
Exits are about 30% quicker than entrances at every speed. Buttons press to 0.97 (0.98 when snappy, not at all when instant), and sheets take 500, 400, 300 and 200ms. Default needs nothing. Set another speed with data-motion on <html>:
<html data-motion="smooth"></html>data-motion works on any element too, and sets the speed for everything inside it, so a marketing page inside an app can be smooth while the rest stays snappy:
<section data-motion="smooth">{/* hero, pricing, … */}</section>Tooltips, menus, popovers and dialogs render in a portal at the end of <body>, so they follow the speed on <html>. data-motion="off" stops all motion.
Roles#
Every animation belongs to a role, and reads that role's tokens. No component writes milliseconds, so components that were never designed together still move at the same pace, and a speed changes all of them at once.
| Role | Covers | Use | Default |
|---|---|---|---|
| feedback | Hover, colour, focus, icon stroke and weight changes | duration-feedback ease-feedback | 150 / 100ms |
| press | Buttons and toggles while held | motion-press | scale 0.97 |
| glide | The Fluid Hover highlight | duration-glide ease-enter | 150 / 100ms |
| move | Tab indicators, switch thumbs, selection, checkmarks, progress, sidebar | duration-move ease-move | 250 / 180ms |
| theme | Full-page theme reveals from the pressed trigger | duration-theme ease-theme | 700 / 700ms |
| tooltip | Tooltips | motion-tooltip | 125 / 90ms |
| popup | Menus, selects, comboboxes, popovers, hover cards, navigation menus | motion-popup | 180 / 120ms |
| dialog | Dialogs and alert dialogs; their scrims | motion-dialog, motion-scrim | 250 / 180ms |
| sheet | Sheets and drawers | motion-sheet | 400 / 250ms |
| disclosure | Accordion and collapsible panels | motion-disclosure | 200 / 150ms |
| toast | Toasts | motion-toast | 350 / 220ms |
The motion-<surface> utilities hold the whole recipe: the entrance and exit durations and curves, the scale a surface grows from, and its slide from the trigger side. They work with keyframe animations (animate-in, animate-out) and with transitions alike. The Radix Drawer is the one exception: it uses Vaul, whose 500ms timing lives in its JavaScript.
Surfaces#
Rules#
The default speed follows Emil Kowalski's guidance on interface animation:
- Ease-out for anything that enters or leaves: it moves at once, so it feels responsive. Ease-in-out for things that move on screen, plain
easefor colour. - Exits are quicker than entrances: you have already moved on.
- Popups grow from their trigger; dialogs grow from the centre. Nothing scales up from less than 0.9.
- Buttons give a little when pressed (0.97). Joined button groups stay flat.
- Tooltips wait before the first one, then appear at once while you move between them, or when they open on focus.
- Nothing opened from the keyboard animates: the command palette appears at once.
- Animate
transformandopacity. Avoid animating layout.
Building a component#
Pick the role and use its utilities. Never write milliseconds or a curve:
// A popup: one utility, plus the keyframes it times.
<PopoverPrimitive.Popup className="motion-popup origin-(--transform-origin) data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0" />
// Colour on hover.
<a className="transition-colors duration-feedback ease-feedback" />
// Something that moves.
<span className="transition-transform duration-move ease-move" />duration-<role>, duration-<role>-exit and delay-<role> exist for every role, and the curves are ease-enter, ease-move, ease-exit, ease-feedback, ease-drawer and ease-theme. In this repository a test fails when a Fabricator style or override uses a fixed duration, a literal curve or a fixed zoom.
Tokens#
The speeds set these tokens. Retune any of them in :root for the default speed, or under :root[data-motion="<speed>"] for another:
| Token | Holds |
|---|---|
--motion-<role>, --motion-<role>-exit | Each role's entrance and exit duration |
--motion-ease-enter, --motion-ease-move, --motion-ease-exit | The entrance, movement and exit curves |
--motion-ease-feedback, --motion-ease-drawer | Colour changes; sheets and drawers |
--motion-ease-theme | Material easing for full-page theme reveals |
--motion-press-scale | The scale while pressed |
--motion-tooltip-scale, --motion-popup-scale, --motion-dialog-scale | The scale each surface grows from |
--motion-tooltip-travel, --motion-popup-travel | The slide from the trigger side |
--motion-popup-blur | The blur popups fade through |
--motion-scale | A multiplier on every duration (1) |
:root {
--motion-popup: 200ms; /* menus a little slower at the default speed */
}
:root[data-motion="smooth"] {
--motion-popup-blur: 0px; /* smooth, without the blur */
}
.onboarding {
--motion-scale: 1.4; /* everything more relaxed, only here */
}The earlier names keep working: duration-fast, duration-moderate and duration-slow are the feedback, move and dialog durations, and ease-spring is the entrance curve.
Reduced motion#
Reduced motion means fewer and gentler animations, not none. With prefers-reduced-motion: reduce, components keep their fades and drop their slides, zooms, blur and press, and Fluid Hover jumps instead of gliding. It applies at every speed.