Motion

Short, quiet and only where it explains a change: where something came from, or where it went.

Animate only to show where something came from or went, keep it to 200ms at most, and leave it out for anyone who asked the system for less motion. In a tool used all day, motion that does not explain anything is waiting time.

CI #1284
  1. Lint5s
  2. Build11s
  3. Test7s

Press Re-run all jobs. A Skeleton holds the place of the job that is running, and each job that finishes fades and drops in from just above in 150ms, so the eye finds the row that changed. With reduced motion turned on, the row fades in where it stands: @orz/ui's stylesheet takes the drop out, as it does for its own overlays.

What moves, and how long#

The components already animate, and an app adds little to them. This is how the default style moves them; another style may move a part its own way.

WhatMotionDuration
A menu, popover, select, hover card or tooltipFades in where it stands100ms
A dialog and its overlayFades in where it stands100ms
A sheetFades in and slides 12px in from its edge100ms
A menu, FilterMenu or select on a phoneFades in and slides 12px up from the bottom edge, as a sheet does; a submenu takes its place without moving, and one sheet handing over to another plays nothing100ms
An auto-hiding header, once scrolling stopsSettles fully in or out150ms
A block a link jumps to (revealBlock)A tint that fades out2s
A SkeletonPulses until the content arrivesuntil then
A DelayedSkeletonFades in once the wait has lasted 500ms; a quicker load shows nothing150ms

Mail's thread toolbar. Hover Archive for its tooltip, open More actions for the menu, Keyboard shortcuts for the dialog, and Folders for the sheet: each fades in, and none moves further than it takes to show where it came from. The Skeleton is in the run above; the auto-hiding header and revealBlock need a page that scrolls, and their Storybook pages show them.

Motion of your own stays in the same range: 100 to 150ms for something small appearing, up to 200ms for something that crosses the screen. Something entering eases out (fast, then settling); something leaving eases in. Leaving is quicker than entering, because nobody needs to watch a thing go.

When not to#

  • Not while a finger drives it. A sheet dragged by a thumb, a header pulled by a scroll, a slider: the element follows the finger with no transition, and animates only to settle once the finger lets go. A transition there trails the finger and feels broken.
  • Not on what the user is reading. A list that re-sorts, a log that appends, a value that updates in place: change it, do not slide it. Motion draws the eye, and the eye was busy.
  • Not to fill a wait. A spinner or skeleton says something is coming; it does not make it arrive sooner. A result that comes back within a few hundred milliseconds needs no loading state at all.
  • Not in a loop. Anything that moves on its own for more than five seconds needs a way to stop it (WCAG 2.2.2); a Skeleton stops by being replaced.
Do

Put movement of your own behind motion-safe:, as in a chevron that turns with motion-safe:transition-transform, so only people who have not asked for less see it.

Don't

Animate layout (height, width, position of large areas) or loop an animation for attention. It costs frames on a phone and makes some readers dizzy.

Reduced motion#

People who get motion sick, or who find movement distracting, turn on Reduce motion in their system settings, and the browser reports it as prefers-reduced-motion: reduce. Honouring it is one of the rules on Accessibility.

  • @orz/ui's overlays already honour it. A menu, popover, select, hover card, tooltip, dialog or sheet keeps its fade and drops any zoom or slide its style gives it, and the auto-hiding header snaps instead of settling. It comes with @orz/ui/styles.css, with nothing to turn on, and covers any markup of your own drawn with the same animate-in / animate-out classes (slide-in-from-*, zoom-in-*, spin-in-*, blur-in-*).
  • Reduced means a fade, not nothing. Opacity still changes, so something appearing reads as arriving rather than blinking in; translation, scale, rotation, blur and parallax go.
  • Motion you add any other way is yours to gate. A transform transition, a keyframe of your own or Tailwind's animate-bounce goes behind motion-safe: (or is undone with motion-reduce:); motion driven from script checks matchMedia("(prefers-reduced-motion: reduce)") first, as @orz/ui-content's image viewer does before it eases its pane to a new height.
  • A spinner keeps spinning, because the motion is the status, and a small transition that answers the hand directly, such as a Switch thumb crossing its track, stays too.

On each platform#

  • Pointer. Hover feedback is a colour change with transition-colors, never a movement.
  • Touch. A press shows at once, with no transition to wait for, and nothing moves under the finger before it lifts.

In the demos