Spinner
An indeterminate loading indicator: a spinning ring in any of the six semantic tones, in three sizes.
Live demo
Spinner signals that work is in progress without a known endpoint. It draws a rotating ring with a single transparent gap, sized in em so it scales with the surrounding type, and carries role="status" so assistive tech announces the busy state.
tone colors the ring across the six semantic roles (accent, neutral, danger, success, warn, info), and size picks sm, md, or lg. The spin runs on --duration-slow; the reduced-motion base rule freezes it for users who ask for less motion. It is presentational and standalone; Button carries its own inline spinner for the loading state.
When to use
How this component composes with the rest of the set.
Props
3 props, straight from the manifest.
| Prop | Type | Default | Bindings | Description |
|---|---|---|---|---|
Appearance
Variants
accent
Accent-toned ring, the default.
neutral
Neutral-toned ring.
danger
Danger-toned ring.
success
Success-toned ring.
warn
Warn-toned ring.
info
Info-toned ring.
Sizes
sm
Compact: thinner ring.
md
Default.
lg
Large.
Anatomy
The named parts that make up the component, with their selectors.
spinner
The rotating ring: a bordered circle with one transparent side, animated on the slow duration.
Tokens & coverage
What the component consumes, checked live against what the algorithm produces.
Live coverage check against the xoji-default register
(derive(xojiDefault, { anchors }) →
coverComponent(manifest, register)). Every token this component
consumes must be a key the algorithm produces.
--accent
--accent-2
--accent-3
--accent-4
--black
--blue
--border-normal
--border-thick
--brown
--cyan
--danger
--duration-slow
--gray
--green
--info
--neutral
--orange
--pink
--purple
--radius-full
--red
--success
--warn
--white
--yellow
Accessibility
Code
Tones and sizes
The six tones across the three sizes: color and scale are independent.
<xoji-spinner aria-label="Loading"></xoji-spinner>
<xoji-spinner size="sm" tone="neutral" aria-label="Loading"></xoji-spinner>
<xoji-spinner size="lg" tone="success" aria-label="Saving changes"></xoji-spinner>
<script lang="ts">
import { Spinner } from "@xoji/svelte";
</script>
<Spinner ariaLabel="Loading" />
<Spinner size="sm" tone="neutral" ariaLabel="Loading" />
<Spinner size="lg" tone="success" ariaLabel="Saving changes" />
---
import { Spinner } from "@xoji/astro";
---
<Spinner aria-label="Loading" />
<Spinner size="sm" tone="neutral" aria-label="Loading" />
<Spinner size="lg" tone="success" aria-label="Saving changes" />