Skip to content

Motion

helix-ui ships a small motion system: a few duration tokens, a few easing tokens, and a set of CSS utility classes that compose them. Components reference the tokens directly, so retuning a theme retunes every animation in one place.

Token Value When to use
motion.duration.instant 0ms Suppress motion (low-power or reduced-motion contexts).
motion.duration.fast 120ms Hover, press, focus ring, tooltip.
motion.duration.normal 180ms Default UI transitions, popovers, toasts.
motion.duration.slow 240ms Sheets, dialogs, drawers entering.
motion.duration.slower 320ms Long collapsing sections, page transitions.

CSS variables: --helix-ui-motion-duration-{instant,fast,normal,slow,slower}.

Token Curve When to use
motion.easing.linear linear Indeterminate progress, spinners.
motion.easing.standard cubic-bezier(0.2, 0, 0, 1) Default UI ease — smooth start, slight settle.
motion.easing.emphasized cubic-bezier(0.32, 0.72, 0, 1) Material-style emphasis. Sheets, toasts.
motion.easing.decelerate cubic-bezier(0, 0, 0.2, 1) Elements entering view.
motion.easing.accelerate cubic-bezier(0.4, 0, 1, 1) Elements exiting view.
motion.easing.spring cubic-bezier(0.16, 1, 0.3, 1) Bouncy spring — entrance scale-ups, hover lifts.

CSS variables: --helix-ui-motion-easing-{linear,standard,emphasized,decelerate,accelerate,spring}.

Imported automatically with @helix-ui/core/styles.css.

<div class="helix-ui-anim-fade-in">…</div>
<div class="helix-ui-anim-slide-in-up">…</div>
<div class="helix-ui-anim-slide-in-down">…</div>
<div class="helix-ui-anim-slide-in-left">…</div>
<div class="helix-ui-anim-slide-in-right">…</div>
<div class="helix-ui-anim-scale-in">…</div>

All use motion.duration.normal + motion.easing.decelerate (or spring for scale-in).

<div class="helix-ui-anim-pulse">…</div>
<!-- attention or loading -->
<div class="helix-ui-anim-spin">…</div>
<!-- 0.9s linear, for spinners -->
<div class="helix-ui-anim-bounce">…</div>
<!-- soft vertical bounce -->
<div class="helix-ui-anim-shimmer">…</div>
<!-- skeleton-style sweep -->

Add helix-ui-anim-stagger to a parent to give the first 12 children incremental animation-delays. Combine with any helix-ui-anim-* class on each child.

<ul class="helix-ui-anim-stagger">
<li class="helix-ui-anim-slide-in-up">First</li>
<li class="helix-ui-anim-slide-in-up">Second</li>
<li class="helix-ui-anim-slide-in-up">Third</li>
</ul>
<button class="helix-ui-tap">Lift on hover, scale on press</button>
<a class="helix-ui-hover-lift">Lift on hover only</a>
<div class="helix-ui-press">Scale on press only</div>
<input class="helix-ui-focus-pulse" />

helix-ui-tap = helix-ui-hover-lift + helix-ui-press. Drop it onto any tappable surface (cards, tiles, custom buttons).

helix-ui respects prefers-reduced-motion: reduce automatically. The motion stylesheet collapses every animation duration and transition duration to 0.01ms, so animations effectively snap to their end state but transitionend / animationend events still fire — useful for components that bind exit cleanup to those events.

You don’t need to add per-component reduced-motion guards.

Because all timings are CSS variables, a DNA theme can rebind motion at a scope:

[data-theme='dense'] {
--helix-ui-motion-duration-fast: 80ms;
--helix-ui-motion-duration-normal: 120ms;
}

Every component inside [data-theme="dense"] becomes snappier without code changes.