Compose Unstyled 2.0 is out! Check the official announcement blog ->

Progress Indicators

Determinate and indeterminate indicators for loading and task progress.

Use progress indicators to show completion state or ongoing work.

View on GitHub
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import com.composables.ui.components.ProgressIndicator
import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.milliseconds

@Composable
fun ProgressIndicatorExample() {
    var progress by remember { mutableFloatStateOf(0.28f) }

    LaunchedEffect(Unit) {
        delay(500.milliseconds)
        progress = 0.64f
    }

    ProgressIndicator(progress = progress, modifier = Modifier.fillMaxWidth())
}

Installation

implementation("com.composables:ui:0.1.0")

Examples

Indeterminate

View on GitHub
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.composables.ui.components.IndeterminateProgressIndicator

@Composable
fun IndeterminateProgressIndicatorExample() {
    IndeterminateProgressIndicator(modifier = Modifier.fillMaxWidth())
}

API Reference

ProgressIndicator

A determinate progress indicator for known completion state.

@Composable
fun ProgressIndicator(
    progress: Float,
    modifier: Modifier = Modifier,
    shape: Shape = RoundedCornerShape(999.dp),
    trackColor: Color = Theme[colors][controlColor],
    indicatorColor: Color = Theme[colors][primaryColor],
    borderColor: Color = Color.Unspecified,
    height: Dp = 6.dp,
)
Parameter Type Description
progress Float Current progress value clamped between 0 and 1.
modifier Modifier Modifier applied to the indicator.
shape Shape Shape used for the track and indicator.
trackColor Color Color used for the indicator track.
indicatorColor Color Color used for the active progress indicator.
borderColor Color Optional border color drawn around the track.
height Dp Height of the progress indicator.

IndeterminateProgressIndicator

A looping progress indicator for ongoing work without a known end point.

@Composable
fun IndeterminateProgressIndicator(
    modifier: Modifier = Modifier,
    shape: Shape = RoundedCornerShape(999.dp),
    trackColor: Color = Theme[colors][controlColor],
    indicatorColor: Color = Theme[colors][primaryColor],
    borderColor: Color = Color.Unspecified,
    height: Dp = 6.dp,
)
Parameter Type Description
modifier Modifier Modifier applied to the indicator.
shape Shape Shape used for the track and indicator.
trackColor Color Color used for the indicator track.
indicatorColor Color Color used for the active progress indicator.
borderColor Color Optional border color drawn around the track.
height Dp Height of the progress indicator.