Skip to content

Spinner

BetaData displayOpen in the workshop

An action of unknown length is running.

.xg-spinner · --lg

Example and markup

Live, from xg-ui.css and xg-ui.js. Switch the brand and mode on the example itself, or for the whole site in the header.

Spinner
Refreshing report…
Markup
<div class="xg-row">
<span class="xg-spinner" aria-hidden="true">
</span>
<span class="xg-spinner xg-spinner--lg" aria-hidden="true">
</span>
<span role="status" class="xg-row xg-text-muted">
<span class="xg-spinner" aria-hidden="true">
</span>Refreshing report…</span>
<button class="xg-btn" type="button" aria-busy="true">
<span class="xg-spinner" aria-hidden="true">
</span>Launching</button>
</div>

States

Hover, focus and pressed are forced here with .is-hover, .is-focus and .is-active so they can be seen side by side; in a product they come from :hover, :focus-visible and :active.

Spinner: every state
StateSpinner
Default · 20
Large · 32
In a button

When to use it

Use it for

inside a busy button; refreshing a widget that keeps its content.

Not for

first page loads (Skeleton); waits under 300 ms.

Rules

  • Never alone on a blank page; say what is loading next to it.

Accessibility

  • role="status" with a text label on the container, spinner itself aria-hidden.

Every color pair this component uses is measured for both brands in light and dark on the Accessibility page.

Also in Data display: Data table, Pagination, KPI card, Status badge, Tag, Avatar, Progress, Chart, Tooltip, Empty state, Skeleton.

Status Beta: usable; class names may still change in a minor release, with a note (see Releasing).