Search documentation

Search pages, components, blocks, styles and colours.

Get started
Skip to content

Motion

PreviousNext

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.

data-motion on this frame sets the speed for everything inside it. Each ball enters on its role's duration and curve and returns on the quicker exit. The settings menu sets the speed for the whole site.
SpeedForTooltipPopupDialogPopups grow from
smoothMarketing sites200ms280ms380ms0.94, slide and blur
defaultMost products125ms180ms250ms0.95
snappyApps used all day100ms140ms180ms0.97
instantDashboards, power toolsnone80ms100msno 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.

RoleCoversUseDefault
feedbackHover, colour, focus, icon stroke and weight changesduration-feedback ease-feedback150 / 100ms
pressButtons and toggles while heldmotion-pressscale 0.97
glideThe Fluid Hover highlightduration-glide ease-enter150 / 100ms
moveTab indicators, switch thumbs, selection, checkmarks, progress, sidebarduration-move ease-move250 / 180ms
themeFull-page theme reveals from the pressed triggerduration-theme ease-theme700 / 700ms
tooltipTooltipsmotion-tooltip125 / 90ms
popupMenus, selects, comboboxes, popovers, hover cards, navigation menusmotion-popup180 / 120ms
dialogDialogs and alert dialogs; their scrimsmotion-dialog, motion-scrim250 / 180ms
sheetSheets and drawersmotion-sheet400 / 250ms
disclosureAccordion and collapsible panelsmotion-disclosure200 / 150ms
toastToastsmotion-toast350 / 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

These open in a portal at the end of the page, so they follow the speed on <html>: change Motion in the settings menu and open them again. Move between the two tooltips: the second one appears at once.

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 ease for 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 transform and opacity. Avoid animating layout.
Invite peopleOpens on the dialog timing.
Exit as slow as the entranceDrags on the way out
Invite peopleOpens on the dialog timing.
Exit about 30% quickerGone before you look for it
Both panels open the same way. Close the left one, then the right one: the left lingers on the way out.

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:

TokenHolds
--motion-<role>, --motion-<role>-exitEach role's entrance and exit duration
--motion-ease-enter, --motion-ease-move, --motion-ease-exitThe entrance, movement and exit curves
--motion-ease-feedback, --motion-ease-drawerColour changes; sheets and drawers
--motion-ease-themeMaterial easing for full-page theme reveals
--motion-press-scaleThe scale while pressed
--motion-tooltip-scale, --motion-popup-scale, --motion-dialog-scaleThe scale each surface grows from
--motion-tooltip-travel, --motion-popup-travelThe slide from the trigger side
--motion-popup-blurThe blur popups fade through
--motion-scaleA 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.