Compose Component

LoadingIndicator

A Material Design loading indicator.

LoadingIndicator social preview

DeterminateLoadingIndicatorSample

@Preview
@Sampled
@Composable
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
fun DeterminateLoadingIndicatorSample() {
    val sliderState = rememberSliderState()
    val animatedProgress by
        animateFloatAsState(
            targetValue = sliderState.value,
            animationSpec =
                spring(
                    dampingRatio = Spring.DampingRatioNoBouncy,
                    stiffness = Spring.StiffnessVeryLow,
                    visibilityThreshold = 1 / 1000f,
                ),
        )

    Column(horizontalAlignment = Alignment.CenterHorizontally) {
        LoadingIndicator(progress = { animatedProgress })
        Spacer(Modifier.requiredHeight(30.dp))
        Text("Set loading progress:")
        Slider(
            state = sliderState,
            onValueChange = { sliderState.value = it },
            modifier = Modifier.width(300.dp),
        )
    }
}

LoadingIndicatorSample

@Preview
@Sampled
@Composable
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
fun LoadingIndicatorSample() {
    Column(horizontalAlignment = Alignment.CenterHorizontally) { LoadingIndicator() }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: