Motion token reader
@interlace/ui — reads the `--ease-*` and `--duration-*` tokens from an element, so animations started from script retune with the brand like the CSS does.
Install
Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.
npx shadcn@latest add https://ds.interlace.tools/r/motion-token.jsonnpx shadcn@latest add @interlace/motion-tokenHistory
This component is at v1.0.0, first shipped in @interlace/ui 2.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.
@interlace/ui 2.0.01 entry
- Addedminor
Animations started from script now follow the brand's
--ease-*and--duration-*tokens, like the CSS does. A newmotion-tokenlib item reads them from the element that moves.Components- @interlace/calendar
- @interlace/time-slot-picker
- @interlace/multi-step-form
- @interlace/commitment
- @interlace/interest-signal
- @interlace/session-composer
- @interlace/guess-reveal
- @interlace/quiz-question
- @interlace/duel
- @interlace/order-game
- @interlace/podium
- @interlace/live-room
- @interlace/word-cloud
- @interlace/answer-pad
- @interlace/tally-bars
- @interlace/standings
- @interlace/closer-game
- @interlace/stagger-list
- @interlace/flip-group
- @interlace/reveal
- @interlace/celebrate
- @interlace/split-text
- @interlace/marker
- @interlace/rotating-text
- @interlace/draw-on
Import
4 named exports — pull the parts you need.
import { MotionDuration, MotionEase, motionDuration, motionEase } from '@/lib/motion-token';Accessibility
Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.
What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.
- Focus + keyboard behaviour
- Native element semantics — no interaction layer to get wrong.
- Focus ring (WCAG 2.2 SC 2.4.13)
- Not focusable — no focus indicator required.
- Reduced motion
- No animation to gate.
- ARIA in the source
- None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.
Dependencies
- Base UI primitive
- Native / no Base UI dependency
- Lucide icons
- none
- NPM dependencies
- none
- Registry dependencies
- none
Source
The full implementation — lib/motion-token.ts once installed.
const EASE = {
enter: 'cubic-bezier(0.16, 1, 0.3, 1)',
exit: 'cubic-bezier(0.5, 0, 0.75, 0)',
move: 'cubic-bezier(0.65, 0, 0.35, 1)',
} as const;
const DURATION = { fast: 100, base: 150, medium: 250, slow: 400 } as const;
export type MotionEase = keyof typeof EASE;
export type MotionDuration = keyof typeof DURATION;
/** Called where an animation starts, which is always in the browser. */
const read = (el: Element, name: string): string => getComputedStyle(el).getPropertyValue(name).trim();
/** The brand's `--ease-{name}` on `el`, for a Web Animations `easing`. */
export function motionEase(el: Element, name: MotionEase): string {
return read(el, `--ease-${name}`) || EASE[name];
}
/** The brand's `--duration-{name}` on `el`, in milliseconds. */
…23 more lines…Registry JSON
The raw registry record — what the shadcn CLI fetches.