ContainedLoadingIndicator

@Composable
fun ContainedLoadingIndicator(progress: () -> Float, modifier: Modifier = Modifier, containerColor: Color = LoadingIndicatorDefaults.containedContainerColor, indicatorColor: Color = LoadingIndicatorDefaults.containedIndicatorColor, containerShape: Shape = LoadingIndicatorDefaults.containerShape, polygons: List<RoundedPolygon> = LoadingIndicatorDefaults.DeterminateIndicatorPolygons)

A Material Design contained loading indicator.

This version of the loading indicator morphs between its polygons shapes by the value of its progress. The shapes in this variation are contained within a colored containerShape.

Contained loading indicator
image

It can be created like this:

Parameters

progress

the progress of this loading indicator, where 0.0 represents no progress and 1.0 represents full progress. Values outside of this range are coerced into the range. The indicator will morph its shapes between the provided polygons according to the value of the progress.

modifier

the Modifier to be applied to this loading indicator

containerColor

the loading indicator's container color

indicatorColor

the loading indicator's color

containerShape

the loading indicator's container shape

polygons

a list of RoundedPolygons for the sequence of shapes this loading indicator will morph between as it progresses from 0.0 to 1.0. The loading indicator expects at least two items in that list.

Throws

if the polygons list holds less than two items

Samples

androidx.compose.material3.samples.DeterminateContainedLoadingIndicatorSampleandroidx.compose.material3.samples.LoadingIndicatorPullToRefreshSample
@Composable
fun ContainedLoadingIndicator(modifier: Modifier = Modifier, containerColor: Color = LoadingIndicatorDefaults.containedContainerColor, indicatorColor: Color = LoadingIndicatorDefaults.containedIndicatorColor, containerShape: Shape = LoadingIndicatorDefaults.containerShape, polygons: List<RoundedPolygon> = LoadingIndicatorDefaults.IndeterminateIndicatorPolygons)

A Material Design contained loading indicator.

This version of the loading indicator animates and morphs between various shapes as long as the loading indicator is visible. The shapes in this variation are contained within a colored containerShape.

Contained loading indicator
image

It can be created like this:

Parameters

modifier

the Modifier to be applied to this loading indicator

containerColor

the loading indicator's container color

indicatorColor

the loading indicator's color

containerShape

the loading indicator's container shape

polygons

a list of RoundedPolygons for the sequence of shapes this loading indicator will morph between. The loading indicator expects at least two items in that list.

Throws

if the polygons list holds less than two items

Samples

androidx.compose.material3.samples.ContainedLoadingIndicatorSample