# 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/material/LinearProgressIndicator.composable#LinearProgressIndicator(androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.StrokeCap)( modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap )` Indeterminate [Material Design linear progress indicator]("https://material.io/components/progress-indicators#linear-progress-indicators"). | 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/material/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://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) 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, backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap )` Determinate [Material Design linear progress indicator]("https://material.io/components/progress-indicators#linear-progress-indicators"). | Cmn |

## Functions

### LinearProgressIndicator

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

```
@Composable
fun LinearProgressIndicator(
    modifier: Modifier = Modifier,
    color: Color = MaterialTheme.colors.primary,
    backgroundColor: Color = color.copy(alpha = IndicatorBackgroundOpacity),
    strokeCap: StrokeCap = StrokeCap.Butt
): Unit
```

Indeterminate [Material Design linear progress indicator]("https://material.io/components/progress-indicators#linear-progress-indicators").

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

![Linear progress indicator
image](https://developer.android.com/images/reference/androidx/compose/material/linear-progress-indicator.png)

| 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 = MaterialTheme.colors.primary` | The color of the progress indicator. |
| `backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = color.copy(alpha = IndicatorBackgroundOpacity)` | The color of the background behind the indicator, visible when the progress has not reached that area of the overall indicator yet. |
| `strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap = StrokeCap.Butt` | stroke cap to use for the ends of this progress indicator |

### LinearProgressIndicator

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

```
@Composable
fun LinearProgressIndicator(
    progress: @FloatRange(from = 0.0, to = 1.0) Float,
    modifier: Modifier = Modifier,
    color: Color = MaterialTheme.colors.primary,
    backgroundColor: Color = color.copy(alpha = IndicatorBackgroundOpacity),
    strokeCap: StrokeCap = StrokeCap.Butt
): Unit
```

Determinate [Material Design linear progress indicator]("https://material.io/components/progress-indicators#linear-progress-indicators").

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

![Linear progress indicator
image](https://developer.android.com/images/reference/androidx/compose/material/linear-progress-indicator.png)

By default there is no animation between `https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#LinearProgressIndicator(kotlin.Float,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.StrokeCap)` values. You can use `https://developer.android.com/reference/kotlin/androidx/compose/material/ProgressIndicatorDefaults#ProgressAnimationSpec()` as the default recommended `https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#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.material.LinearProgressIndicator
import androidx.compose.material.OutlinedButton
import androidx.compose.material.ProgressIndicatorDefaults
import androidx.compose.material.Text
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

var progress by remember { mutableStateOf(0.1f) }
val animatedProgress by
    animateFloatAsState(
        targetValue = progress,
        animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec,
    )

Column(horizontalAlignment = Alignment.CenterHorizontally) {
    LinearProgressIndicator(progress = animatedProgress)
    Spacer(Modifier.requiredHeight(30.dp))
    OutlinedButton(onClick = { if (progress < 1f) progress += 0.1f }) { Text("Increase") }
}
```

| Parameters |
|---|---|
| `progress: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) 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 = MaterialTheme.colors.primary` | The color of the progress indicator. |
| `backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = color.copy(alpha = IndicatorBackgroundOpacity)` | The color of the background behind the indicator, visible when the progress has not reached that area of the overall indicator yet. |
| `strokeCap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap = StrokeCap.Butt` | stroke cap to use for the ends of this progress indicator |