Loading indicator

Loading indicator

A shape that morphs while it spins, for waits under five seconds.

M3 Expressive's indicator for a short wait. One element, CSS-only, no JavaScript plugin. The shape morphs through a circle and four cookie shapes while the whole thing rotates.

<span class="loading-indicator" role="status" aria-label="Loading"></span>

The element is empty, so it reports nothing on its own. role="status" announces the wait and aria-label gives it something to announce — not role="progressbar", which promises an aria-valuenow an indeterminate indicator does not have.

Contained

contained puts the indicator on a secondary-container circle and switches it to on-secondary-container. Use it over an image, a coloured surface, or anything else the plain indicator would get lost against.

<span class="loading-indicator contained" role="status" aria-label="Loading"></span>

Or a progress indicator?

This supersedes the indeterminate circular progress indicator. Reach for the loading indicator whenever you would have written <span class="progress circular"> with no value. .progress keeps everything else — both linear bars, and every case where you know the percentage.

SituationUse
Under 200 msNothing — show the result
Up to about 5 s, percentage unknown.loading-indicator
Longer, percentage known.progress, determinate
Longer, percentage unknown.progress, indeterminate linear

Tokens

Override any of these to retheme one indicator. The colours are role tokens, never raw hex.

TokenDefaultWhat it sets
--md-comp-loading-indicator-active-indicator-size38pxThe morphing shape.
--md-comp-loading-indicator-container-size48pxThe box it sits in — the visible circle when contained.
--md-comp-loading-indicator-active-indicator-colorprimaryThe shape's fill.
--md-comp-loading-indicator-container-colortransparentThe container fill.
--md-comp-loading-indicator-duration3000msOne full morph-and-spin cycle.
<span class="loading-indicator"
      style="--md-comp-loading-indicator-active-indicator-color: var(--md-sys-color-error)"
      role="status" aria-label="Loading"></span>

prefers-reduced-motion: reduce stops both animations and leaves the circle.

  • Source color

    The seed every generated ramp derives from. Pick one and browse the docs — the whole theme follows. Error does not: it is a fixed hue.