Skip to content

Spinner

An indeterminate loading indicator with a required accessible name.

x
Indexing documents…
hero.tsx

Usage guidelines

  • Name every spinner: Spinner is a progress bar with no value. Give it exactly one accessible name, through aria-labelledby when visible text describes the work, or aria-label otherwise. 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 Progress for a task with measurable completion.
  • Keep status announcements with the feature: Spinner does not announce completion or set aria-busy on the region that is loading. The feature that owns the request owns those.
  • Use SpinnerIcon inside a control that is already named: SpinnerIcon is the same artwork, always hidden from assistive technology. A Button with loading draws 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.

x
small · 12px
x
medium · 16px
x
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.

Props
PropTypeDefaultDetails
size'large' | 'medium' | 'small''medium'
classNamestringNo default
aria-labelstringNo default
aria-labelledbystringNo default

Valid prop combinations:

  • aria-label: string, aria-labelledby?: undefined
  • aria-label?: undefined, aria-labelledby: string

SpinnerIcon

A decorative loading spinner graphic hidden from assistive technology. Renders an <svg> element.

Props
PropTypeDefaultDetails
size'large' | 'medium' | 'small''medium'
classNamestringNo default