Skip to the content

Spinner

Spinner is an indeterminate loading indicator for work with no predictable duration. Without size it measures 1em, so it scales with the surrounding font and fits any slot that takes an Icon.
Feedback & Loading

When to use

Use when
  • A request or first load runs and you cannot estimate how long it takes.
  • A button or icon slot must show that its action is in progress.
  • You need a "next refresh in…" ring next to polled data (variant="countdown").
Avoid when
  • You know the percentage — use ProgressBar.
  • The layout of the incoming content is known — use Skeleton.
  • Nothing is loading. A spinner that never stops reads as a failure.

Usage

<Spinner />
<Spinner size={32} color="primary" />
<IconButton icon={<Spinner />} size="small" label="Loading" />

size takes a number (px) or any CSS length. color takes a theme color and paints the arc. IconButton swaps its icon for a Spinner while isLoading, and InputSelect shows one while loading options.

Countdown ring

variant="countdown" is determinate: the arc drains over duration (ms, default 15000) and refills whenever cycle changes. Pass the last poll timestamp or a counter.

<Spinner variant="countdown" duration={15000} cycle={lastPollAt} color="primary" />

Accessibility

  • The default variant renders role="status"; the countdown renders role="timer".
  • label is the accessible name (default 'Carregando'). Localize it and say what is loading.
  • Keep one announcing spinner per loading region; several live regions at once become noise.
  • When visible loading text sits next to it, pass aria-hidden to avoid a duplicate announcement.

Properties

Also accepts the layout props.

See also