Spinner
An indeterminate loading indicator with a required accessible name.
Indexing documents…
hero.tsx
Usage guidelines
- Name every spinner:
Spinneris a progress bar with no value. Give it exactly one accessible name, througharia-labelledbywhen visible text describes the work, oraria-labelotherwise. The caller passes localized text. - Use Progress when the amount is known: A spinner says that work is running, not how much is done. Use
Progressfor a task with measurable completion. - Keep status announcements with the feature:
Spinnerdoes not announce completion or setaria-busyon the region that is loading. The feature that owns the request owns those. - Use SpinnerIcon inside a control that is already named:
SpinnerIconis the same artwork, always hidden from assistive technology. AButtonwithloadingdraws its own spinner, so do not add a second one inside it. - Keep layout outside: Both parts occupy only their own size, 12, 16 or 20 pixels. Placeholders, centering, delays and page geometry belong to the caller.
Anatomy
tsx
tsx
The artwork is four squares on a two-second opacity cycle, with a still frame when the user prefers reduced motion. It is blue in both themes; className can set another text color token.
Examples
Sizes
small, medium (the default) and large render 12, 16 and 20 pixels.
small · 12px
medium · 16px
large · 20px
sizes.tsx
Icon inside a control
SpinnerIcon replaces an icon while the control that owns the loading state stays named and marks itself aria-busy. Here the button stays focusable while it is disabled.
icon.tsx
API reference
Spinner
An indeterminate loading indicator; requires aria-label or aria-labelledby. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
size | 'large' | 'medium' | 'small' | 'medium' | |
className | string | No default | |
aria-label | string | No default | |
aria-labelledby | string | No default | |
Valid prop combinations:
aria-label: string,aria-labelledby?: undefinedaria-label?: undefined,aria-labelledby: string
SpinnerIcon
A decorative loading spinner graphic hidden from assistive technology. Renders an <svg> element.
| Prop | Type | Default | Details |
|---|---|---|---|
size | 'large' | 'medium' | 'small' | 'medium' | |
className | string | No default | |