Loading indicator
ExpressiveAn Expressive shape that morphs while it rotates; replaces the spinning circle.
import { LoadingIndicator } from '@windmorph/react';Props
LoadingIndicator 10 props
Progress from 0 to 1, for a progress-driven gesture such as pull to refresh. Leave it out (the usual case) for an indeterminate indicator, which morphs through its shapes while rotating. Don't switch one indicator from indeterminate to determinate: the spec says a loading indicator never turns into a progress indicator; use a progress indicator instead.
containeddraws the indicator on aprimary-containercircle.At least two shapes (
MaterialShapesnames orRoundedPolygons). Defaults to Compose's sequences: seven shapes when indeterminate, circle → soft burst when determinate.The box's size in px. The spec: "Loading indicators default to 48dp, but the size is flexible. It should be between 24dp to 240dp"; the shape keeps its ratio to the box. Values outside that range are clamped.
Ref to the root element.
Text
Names the indicator ("Loading messages"). Required unless
aria-labelledbyis set.The id of the visible text that names the indicator. Required unless
aria-labelis set.
Classes for each part, by slot.
classNames.rootis merged withclassName.Inline styles for the root element.
Classes for the root element, merged with the component's own (yours win).
Also accepts the root element's HTML attributes (id, data-*, event handlers).
Tokens
M3's component tokens as CSS variables. Each is unset until you set it, on :root, a theme or any ancestor, and falls back to the default shown. The root carries data-variant (and data-size where it has sizes), which picks the variables that apply. See Component tokens in the Customisation guide.
| Variable | Default | Paints | Compose |
|---|---|---|---|
| Default (variant) | |||
--md-comp-loading-indicator-active-indicator-color | var(--md-sys-color-primary) | The morphing shape. | LoadingIndicatorTokens.ActiveIndicatorColor |
| Contained (variant) | |||
--md-comp-loading-indicator-contained-active-indicator-color | var(--md-sys-color-on-primary-container) | The morphing shape of a contained indicator. | LoadingIndicatorTokens.ContainedActiveColor |
--md-comp-loading-indicator-contained-container-color | var(--md-sys-color-primary-container) | The round container behind it. | LoadingIndicatorTokens.ContainedContainerColor |
Spec status
Built to the M3 Expressive loading indicator spec. Each item of its variants and configurations links to a live example; where the M3 Expressive column of the spec differs from the original M3 one, it wins.
| Item | Status | Details |
|---|---|---|
| Loading indicator | Built | Variant · Indeterminate |
| Containment: default | Built | Configuration · Indeterminate, Shapes |
| Containment: contained | Built | Configuration · Indeterminate, Determinate |
| Following a gesture (pull to refresh) | Built | Use case · Determinate |
| Size: 48dp by default, flexible from 24 to 240dp | Built | Configuration · Determinate |
Loading indicator
BuiltVariant · Indeterminate
Containment: default
BuiltConfiguration · Indeterminate, Shapes
Containment: contained
BuiltConfiguration · Indeterminate, Determinate
Following a gesture (pull to refresh)
BuiltUse case · Determinate
Size: 48dp by default, flexible from 24 to 240dp
BuiltConfiguration · Determinate
Bundle size
Gzipped, as published: the component and the library code it imports. React, React Aria, Motion and the other dependencies aren't counted, and your bundler's minifier makes it smaller still. CI fails a change that grows it past its budget.
LoadingIndicator: 24.0 kB
M3 Expressive specs
- Shape
rounded-corner-full- Variants
default, contained
Differences from Compose
- A 48px box with full corners by default.
sizesets it in px within the spec's 24–240px range (values outside it are clamped), or asize-*class resizes it. The shape scales with the box, kept square and centred by the viewBox. variantisdefault(aprimaryindicator) orcontained(on-primary-containeron aprimary-containercircle).- Indeterminate loops Compose's seven shapes, springing to the next every 650ms with a quarter-turn of rotation; determinate morphs a circle into a soft burst as
valuerises.shapesoverrides the sequence with two or moreMaterialShapesnames orRoundedPolygons. - Every frame is a pure function of elapsed time (tested against Compose's numbers). The indeterminate loop writes the path and the inner
<g>rotation straight to the SVG on Motion's animation frames, so it causes no React renders.