Skip to content
IndexRequest a UIAboutContact

Spinner

Indeterminate loading indicators in three styles with accessible status text.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Build three spinner variants side by side, each labelled: a ring (40px, 3px border with a coloured top segment rotating 800ms linear infinite), three bouncing dots (10px circles bouncing 8px with 1000ms duration and 150ms stagger) and a pulsing circle (scale 0.6 to 1 with fading opacity over 1200ms). Wrap each in an element with role="status" and a visually hidden "Loading" text. Add a "Simulate request" button that shows a spinner after a 200ms delay (so very fast responses never flash one), keeps it for 1.5 seconds, then replaces it with the text "Done". Under prefers-reduced-motion replace all movement with a static visible "Loading…" caption.

About this pattern

Definition

A small animated shape that tells the user a process is running when the duration is unknown. This page shows three versions: a rotating ring, bouncing dots and a pulsing circle.

Purpose & UX principles

  • Use only for short, indeterminate waits (about 1 to 10 seconds). Longer waits need a progress indicator or an explanation.
  • Always pair it with text, either visible ("Loading messages…") or hidden for screen readers.
  • Delay showing it by about 200ms; spinners that flash for a moment feel slower than none.

Interaction states

  • Idle (hidden), delayed, visible with role="status", removed on completion.
  • Use aria-live="polite" text so assistive technology announces start and finish.

Motion specification

  • Ring: 800ms linear rotation.
  • Dots: 1000ms bounce, 150ms stagger.
  • Pulse: 1200ms scale and fade.
  • Reduced motion: replace movement with a static "Loading…" label.

Responsive behaviour

  • Size scales with the surrounding control: 16px inside buttons, 24px inline, 40px for sections.
  • Centre in the area that is loading and keep that area's size stable.

Code

HTML
<div class="row">
  <figure><div class="ring" role="status"><span class="sr">Loading</span></div><figcaption>Ring</figcaption></figure>
  <figure><div class="dots" role="status"><i></i><i></i><i></i><span class="sr">Loading</span></div><figcaption>Dots</figcaption></figure>
  <figure><div class="pulse" role="status"><span class="sr">Loading</span></div><figcaption>Pulse</figcaption></figure>
</div>
<div class="sim"><button id="go">Simulate request</button><p id="out" role="status" aria-live="polite"></p></div>

Related patterns

Skeleton Loading

↗
Skeleton LoadingLoading & Progress

Progress Indicator

↗
Progress IndicatorLoading & Progress

Primary & Secondary Button

↗
Primary & Secondary ButtonButtons & Actions