# LinearProgressIndicator

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material3/LinearProgressIndicator.composable#LinearProgressIndicator(androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.StrokeCap,androidx.compose.ui.unit.Dp)( modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, trackColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap, gapSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp )` [Material Design indeterminate linear progress indicator](https://m3.material.io/components/progress-indicators/overview) | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable [LinearProgressIndicator](https://developer.android.com/reference/kotlin/androidx/compose/material3/LinearProgressIndicator.composable#LinearProgressIndicator(kotlin.Float,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.StrokeCap))( progress: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, trackColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap )` **This function is deprecated.** Use the overload that takes \`progress\` as a lambda | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material3/LinearProgressIndicator.composable#LinearProgressIndicator(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.StrokeCap,androidx.compose.ui.unit.Dp,kotlin.Function1)( progress: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, trackColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap, gapSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, drawStopIndicator: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` [Material Design determinate linear progress indicator](https://m3.material.io/components/progress-indicators/overview) | Cmn |

## Functions

### LinearProgressIndicator

Cmn Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/ProgressIndicator.kt+function:LinearProgressIndicator)

```
@Composable
fun LinearProgressIndicator(
    modifier: Modifier = Modifier,
    color: Color = ProgressIndicatorDefaults.linearColor,
    trackColor: Color = ProgressIndicatorDefaults.linearTrackColor,
    strokeCap: StrokeCap = ProgressIndicatorDefaults.LinearStrokeCap,
    gapSize: Dp = ProgressIndicatorDefaults.LinearIndicatorTrackGapSize
): Unit
```

[Material Design indeterminate linear progress indicator](https://m3.material.io/components/progress-indicators/overview)

Progress indicators express an unspecified wait time or display the duration of a process.

![Linear progress indicator
image](https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Flqdiyyvh-1P-progress-indicator-configurations.png?alt=media)

```kotlin
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.ui.Alignment

Column(horizontalAlignment = Alignment.CenterHorizontally) { LinearProgressIndicator() }
```

| Parameters |
|---|---|
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to this progress indicator |
| `color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = ProgressIndicatorDefaults.linearColor` | color of this progress indicator |
| `trackColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = ProgressIndicatorDefaults.linearTrackColor` | color of the track behind the indicator, visible when the progress has not reached the area of the overall indicator yet |
| `strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap = ProgressIndicatorDefaults.LinearStrokeCap` | stroke cap to use for the ends of this progress indicator |
| `gapSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = ProgressIndicatorDefaults.LinearIndicatorTrackGapSize` | size of the gap between the progress indicator and the track |

### LinearProgressIndicator

Cmn Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/ProgressIndicator.kt+function:LinearProgressIndicator)

```
@Composable
fun [LinearProgressIndicator](https://developer.android.com/reference/kotlin/androidx/compose/material3/LinearProgressIndicator.composable#LinearProgressIndicator(kotlin.Float,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.StrokeCap))(
    progress: Float,
    modifier: Modifier = Modifier,
    color: Color = ProgressIndicatorDefaults.linearColor,
    trackColor: Color = ProgressIndicatorDefaults.linearTrackColor,
    strokeCap: StrokeCap = ProgressIndicatorDefaults.LinearStrokeCap
): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Use the overload that takes \`progress\` as a lambda, use this instead:
>
> ```kotlin
> LinearProgressIndicator(
> progress = { progress },
> modifier = modifier,
> color = color,
> trackColor = trackColor,
> strokeCap = strokeCap,
> )
> ```

### LinearProgressIndicator

Cmn Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/ProgressIndicator.kt+function:LinearProgressIndicator)

```
@Composable
fun LinearProgressIndicator(
    progress: () -> Float,
    modifier: Modifier = Modifier,
    color: Color = ProgressIndicatorDefaults.linearColor,
    trackColor: Color = ProgressIndicatorDefaults.linearTrackColor,
    strokeCap: StrokeCap = ProgressIndicatorDefaults.LinearStrokeCap,
    gapSize: Dp = ProgressIndicatorDefaults.LinearIndicatorTrackGapSize,
    drawStopIndicator: DrawScope.() -> Unit = {
        drawStopIndicator(
            drawScope = this,
            stopSize = ProgressIndicatorDefaults.LinearTrackStopIndicatorSize,
            color = color,
            strokeCap = strokeCap,
        )
    }
): Unit
```

[Material Design determinate linear progress indicator](https://m3.material.io/components/progress-indicators/overview)

Progress indicators express an unspecified wait time or display the duration of a process.

![Linear progress indicator
image](https://firebasestorage.googleapis.com/v0/b/design-spec/o/projects%2Fgoogle-material-3%2Fimages%2Flqdiyyvh-1P-progress-indicator-configurations.png?alt=media)

By default there is no animation between `https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#LinearProgressIndicator(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.StrokeCap,androidx.compose.ui.unit.Dp,kotlin.Function1)` values. You can use `https://developer.android.com/reference/kotlin/androidx/compose/material3/ProgressIndicatorDefaults#ProgressAnimationSpec()` as the default recommended `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` when animating progress, such as in the following example:

```kotlin
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.width
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.ProgressIndicatorDefaults
import androidx.compose.material3.Slider
import androidx.compose.material3.Text
import androidx.compose.material3.rememberSliderState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

val sliderState = rememberSliderState(0.1f)
val animatedProgress by
    animateFloatAsState(
        targetValue = sliderState.value,
        animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec,
    )

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

| Parameters |
|---|---|
| `progress: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | the progress of this progress indicator, where 0.0 represents no progress and 1.0 represents full progress. Values outside of this range are coerced into the range. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to this progress indicator |
| `color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = ProgressIndicatorDefaults.linearColor` | color of this progress indicator |
| `trackColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = ProgressIndicatorDefaults.linearTrackColor` | color of the track behind the indicator, visible when the progress has not reached the area of the overall indicator yet |
| `strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap = ProgressIndicatorDefaults.LinearStrokeCap` | stroke cap to use for the ends of this progress indicator |
| `gapSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = ProgressIndicatorDefaults.LinearIndicatorTrackGapSize` | size of the gap between the progress indicator and the track |
| `drawStopIndicator: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html = { drawStopIndicator( drawScope = this, stopSize = ProgressIndicatorDefaults.LinearTrackStopIndicatorSize, color = color, strokeCap = strokeCap, ) }` | lambda that will be called to draw the stop indicator. Note that a custom indicator implementation should also handle RTL layouts. |