Components
Components
Spinner
Indeterminate loading indicator for inline and status feedback.
stablefree
pnpm add @komponents/uiCanonical TypeScript source · tree-shakeable subpathsSpinner is a decorative indeterminate indicator. It renders aria-hidden —
announce loading through the surrounding region or control text instead.
Loading results
Usage
Sizing and color
Spinner is a 1rem square by default and inherits currentColor, so it takes
the color of whatever it sits inside. Override either with className:
Inside a button
Button renders a Spinner for you when isLoading is set — you do not need to
compose one yourself:
Accessibility
Spinner is aria-hidden by design. A spinning shape carries no meaning for a
screen reader, so it is never announced on its own — the surrounding context
has to do that work.
- Pair it with a live region when the spinner is the only signal that something is happening:
- Inside
Button, the accessible name already conveys state and the button is disabled while loading — no extra live region is needed. - Do not add
role="status"oraria-labelto Spinner itself. Announce the state on the region that owns it, or the message is read out of context. - Motion respects
prefers-reduced-motion: reducein CSS: the rotation stops and the ring resolves to a static, dimmed indicator. No JavaScript involved, so it works before hydration.