Skip to content

ExpressiveCSS

Browse documentation

Loading indicator

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

View as Markdown

The loading indicator is M3 Expressive's indicator for a short wait. It is a single CSS-only element and needs no JavaScript plugin. The shape morphs through a circle and four cookie shapes while the whole indicator rotates.

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

The element is empty, so it reports nothing on its own. Give the waiting state a name and make status text updates meaningful. Then check what assistive technology actually announces, because a name alone does not guarantee an announcement. The framework currently requires a named status. An indeterminate progressbar, which omits aria-valuenow, is also valid.

Contained

Add contained to put the indicator on a secondary-container circle and switch 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?

Use it for short waits with unknown progress. It replaces most indeterminate circular uses. Keep a progress indicator for a process that will switch to a determinate value. Google's button guidance also keeps circular progress.

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, which is 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.

No matching pages

  • 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.

    Default source: Mist Iris.

    ExpressiveCSS presets: Lagoon, Harbor, Breeze, Cobalt, Iris.

    Bold

    Soft

    Mist

    Glow