Skip to content

Motion helpers

CSS-transition helpers for components that animate without motion/react: easing strings, interaction durations, reduced-motion checks and the size morph FancyButton uses.

Motion for code that animates without motion/react: CSS and the Web Animations API. easeOut, easeInOut and easeSpring are CSS easing strings and duration holds milliseconds for a press, a release, a hover, an entrance, an exit and a morph. useSizeMorph({ axis }) returns a ref: the element's width or height then glides whenever its content changes size, which is how a button follows a label that changes. prefersReducedMotion() reads the reader's setting at the moment you call it, in the browser, so call it in a handler or an effect and never while rendering; useSizeMorph already honours it. For motion/react springs and durations, use @khaeli/motion-tokens.

Width that follows its label

Atlas redesign

Height that follows its content

Release 4.2

Twelve tasks shipped.

Eases with the Web Animations API

  • easeOut
  • easeInOut
  • easeSpring

Installation

npx shadcn@latest add @khaeli/motion

Installs with

Nothing else. This item needs no other Registry item and no npm package.

Accessible name

  • A control whose label changes keeps one meaning: say the state with aria-pressed or aria-expanded, not with the label alone.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/motion.json