Composables
Docs Login
Pairel

Progress Indicator

Jetpack Compose Component

Download
package com.composables.pairel.components

import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import com.composables.pairel.theme.Theme
import com.composeunstyled.Indicator
import com.composeunstyled.UnstyledProgress

@Composable
fun ProgressIndicator(progress: Float, modifier: Modifier = Modifier) {
    val animatedProgress by animateFloatAsState(progress.coerceIn(0f, 1f), label = "Progress")
    UnstyledProgress(
        progress = animatedProgress,
        modifier =
            modifier
                .fillMaxWidth()
                .height(8.dp)
                .clip(Theme.shapes.fullyRounded)
                .background(Theme.colors.surfaceVariant),
    ) {
        Indicator(Modifier.clip(Theme.shapes.fullyRounded).background(Theme.colors.accent))
    }
}

More components from Pairel

by Alex Styl

Search screens and components

Screen flows

Screens

UI Elements

One Android lesson, every Wednesday

Building Android apps?

What Alex learned building Android apps for 14 years, so you don't have to. Reads in under a minute.

Join 3,500+ Android developers. Unsubscribe any time.

You're subscribed

The next lesson lands in on Wednesday.