Loading indicator

A morphing shape that shows an indeterminate wait of up to a few seconds.

When to use

Use it for short waits such as pull to refresh. For longer or measurable work, use a progress indicator.

The indicator cycles through a sequence of shapes while it rotates. Pass a progress lambda to drive the morph from a known value instead.

Playground

The interactive page has a playground with live property controls for this component and generated code.

Examples

Plain and contained

The contained version sits on a rounded container.

LoadingIndicator()
ContainedLoadingIndicator()

Driven by progress

The morph follows the progress value.

val transition = rememberInfiniteTransition(label = "progress")
val progress by transition.animateFloat(
    initialValue = 0f,
    targetValue = 1f,
    animationSpec = infiniteRepeatable(tween(3_000, easing = LinearEasing), RepeatMode.Restart),
    label = "progress",
)

LoadingIndicator(progress = { progress })

Parameters

NameTypeDefaultDescription
progress() -> FloatOptional. When set, the indicator is determinate and morphs with the value from 0 to 1.
colorColorLoadingIndicatorDefaults.indicatorColorColor of the shape.
polygonsList<RoundedPolygon>IndeterminateIndicatorPolygonsShapes to morph between.
containerColorColorcontainedContainerColorContained only. Color of the container.

Guidelines

Do:

Don't:

Accessibility

Related components