Skip to content

Motion

Shared transition classes for overlays, indicators, and color changes. Prefer CSS scale on centered modals so translate centering stays intact.

Examples

Centered popup

Overview

Import motion from @standard-ui/react (via component internals) or copy the class strings from the table below. All tokens include motion-reduce:transition-none.

tsx

import { motion } from "@standard-ui/react"

<div className={cn(motion.backdrop, "fixed inset-0 bg-black/40")} />

Tokens

TokenUse
motion.backdropOverlay fade (Dialog, Command, Drawer).
motion.popupCenterCentered modals — scale + opacity.
motion.popupAnchorMenus, select, tooltip — transform-origin from Base UI.
motion.accordionPanelHeight expand/collapse.
motion.tabsIndicatorSliding tab underline / pill.
motion.colorsHover and pressed color transitions.
motion.transformIcon rotates and simple transforms.
motion.allGeneric all-properties transition (sparingly).

Guidelines

Do

  • Keep durations short (150–200ms)
  • Use popupCenter for dialogs; popupAnchor for floating UI

Don't

  • Don't animate translate on centered popups that already use -translate-x/y-1/2
  • Don't skip reduced-motion handling