Skip to content
IndexRequest a UIAboutContact

Loader Variants

Four compact loaders (dots, bars, ring, pulse) with a switch that starts and stops loading and announces it.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Design a small loading indicator component with four variants chosen by a segmented control: three bouncing dots, five vertical bars scaling in a wave, a thin rotating ring, and a softly pulsing circle. Monochrome near-black on a light card, 32 pixel size, centred with a short "Loading" label beneath. A toggle switch starts and stops loading; when stopped, show a check icon and the text "Loaded". Use role status with an aria-live message, aria-busy on the container, and a prefers-reduced-motion version that blinks opacity slowly instead of moving. No external libraries; plain HTML, CSS and a few lines of JavaScript.

About this pattern

Definition

A loader tells people the system is working. Dots suit chat and short waits, bars suit audio or data, rings suit general waiting, and pulses suit calm background activity.

Purpose & UX principles

  • Use an indeterminate loader when the duration is unknown; use a progress bar when it is known.
  • Show a loader only after about 300ms so quick actions do not flash; keep it visible for at least 400ms once shown.
  • Always pair it with text for screen readers (role status) and stop it when the work finishes.

Interaction states

  • Four buttons choose the variant; the switch turns loading on or off. While off, the area shows the loaded content.

Motion specification

  • Dots bounce 1s loop with 150ms stagger; bars scale 0.9s loop; ring rotates 0.8s linear; pulse scales 1.4s ease-in-out.
  • Reduced motion: loaders become a gentle opacity blink at a slow rate instead of moving shapes.

Responsive behaviour

  • Loaders keep a fixed size; centre them in the area that is waiting.
  • Place the label beside or under the loader, not inside it.

Code

HTML
<div class="bx"><div class="area" id="area" role="status" aria-live="polite"><div class="ld" id="ld"></div><p class="lb" id="lb">Loading</p></div>
<div class="pre" id="pre" role="group" aria-label="Loader variant"><button data-v="dots" aria-pressed="true">Dots</button><button data-v="bars" aria-pressed="false">Bars</button><button data-v="ring" aria-pressed="false">Ring</button><button data-v="pulse" aria-pressed="false">Pulse</button></div>
<label class="sw"><input id="on" type="checkbox" checked> Loading</label></div>

Related patterns

Spinner

↗
SpinnerLoading & Progress

Skeleton Loading

↗
Skeleton LoadingLoading & Progress

Progress Indicator

↗
Progress IndicatorLoading & Progress