Atoms · Spinner
Spinner
A busy indicator for an indeterminate wait, meaning one with no known end or percentage. It comes in two forms. The ring has a lit arc that grows and slides as it turns. The conveyor is a row of shaded blocks, for a wait that sits inside a line of text.
- Best for
- A short wait with no known end, inside a control or a line of text.
- Not for
- Progress with a known amount (use Progress), or a wait for a whole page (use Skeleton or LoadingAnimation).
This page as Markdown, a plain-text copy for a coding agent (an AI tool that writes code).
Examples
Ring, three sizes
Loading field kitsLoading field kitsLoading field kits
Code
tsx
<Spinner size="sm" label="Loading field kits" /><Spinner size="md" label="Loading field kits" /><Spinner size="lg" label="Loading field kits" />Conveyor, three sizes
Syncing manifestSyncing manifestSyncing manifest
Code
tsx
<Spinner variant="conveyor" size="sm" label="Syncing manifest" /><Spinner variant="conveyor" size="md" label="Syncing manifest" /><Spinner variant="conveyor" size="lg" label="Syncing manifest" />Decorative, inside a control
Dispatching…
Code
tsx
<span className="inline-flex items-center gap-2 border border-[var(--color-border-hairline-strong)] px-3 py-2"> <Spinner aria-hidden="true" /> <span className="text-sm">Dispatching…</span></span>Anatomy
| Part | What it is |
|---|---|
| span | The root. It gets role="status" only when it's labelled. |
| Ring (ring) | An SVG (Scalable Vector Graphics) track at 20% of currentColor, which is the surrounding text colour, plus an arc in currentColor. That's accent.signal.indicator by default. |
| Blocks (conveyor) | Three block glyphs, from full to half shade, running over a ten-cell track in border.control. |
| sr-only label | The text a screen reader announces. sr-only means it's hidden on screen but still read aloud. It's only there when label is passed. |
Props
- variant'ring' | 'conveyor'Default 'ring'
- The rotating ring, or the block conveyor.
- size'sm' | 'md' | 'lg'Default 'md'
- Ring: a 14px, 20px or 24px (pixel) box. Conveyor: 12px, 14px or 16px glyphs.
- labelstring
- Status text that's hidden on screen. Passing it makes the spinner a live region, an area whose changes screen readers announce on their own.
- classNamestring
- Merged with the component's classes. Later Tailwind utilities (the small styling classes this system uses) win.
- refRef<HTMLSpanElement>
- Forwarded to the span element.
- ...restOmit<HTMLAttributes<HTMLSpanElement>, 'role'>
- Every native span prop except role, spread onto the span. role is removed from the type instead of being quietly overridden at runtime. Here's why: label is the only source of role="status", and a role in rest would silence the live region a caller asked for when they passed label.
Keyboard
You can't reach this component with the keyboard. It has no keyboard behaviour of its own.
Do and don't
Do
- Pass label whenever the spinner is the only sign that something's happening.
- Leave it decorative inside a control that already announces aria-busy, like Button. aria-busy is an ARIA (Accessible Rich Internet Applications) attribute that tells screen readers a part of the page is still loading.
- Name what's loading, not the fact of loading: ‘Loading field kits’, not ‘Loading’.
Don't
- Don't use it for progress with a known amount. That's Progress.
- Don't rely on the rotation alone. It stops when someone has turned on reduced motion in their system settings, so the label carries the meaning.
- Don't scale it past lg. A page-level wait needs a skeleton, not a bigger spinner.
- Don't bevel it. It's the one round shape in the system. A cut corner on something that rotates would travel around the edge instead of marking one spot.