SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

spin

Continuous 360° rotation for a busy indicator's glyph, resolved entirely to @keyframes so it runs from server-rendered markup.

tsx
import { spin } from "@sdxc/ui/animations";

Usage

Continuous 360° rotation for a busy indicator's glyph, resolved entirely to @keyframes so it runs from server-rendered markup. Under prefers-reduced-motion: reduce, a gentle opacity breathe carries it.

Signature

typescript
spin<Node extends Element = Element>(options?: Spin.Options): Mixin<Node>

Returns a @sdxc/u mixin ready for a spinner's host element.

Parameters

ParameterTypeDefaultRequiredDescription
optionsSpin.Options—NoTiming and gating for the loop.

Examples

tsx
<Spinner mix={[spin()]} aria-label={t("status.loading")} />

The events, constants and types its module publishes, each imported from @sdxc/ui/animations too.

Interface

Spin.Options

Tuning for a spin loop: timing and the platform state it runs under.

MemberTypeDefaultRequiredDescription
durationstring—NoLength of one full rotation, as a CSS time. Defaults to DEFAULT_SPIN_DURATION.
easingstring—NoCSS easing function driving the rotation. Defaults to DEFAULT_SPIN_EASING.
whenstring—NoSelector fragment, relative to the host (e.g. [aria-busy="true"]), that gates the loop. Left unset, the loop runs as soon as it is mixed in, matching a spinner that is mounted only while busy.
@sdxc/ui

Can’t find it? Contact us