# LevelIndicator

## 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/wear/compose/material3/LevelIndicator.composable#LevelIndicator(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.wear.compose.material3.LevelIndicatorColors,androidx.compose.ui.unit.Dp,kotlin.Float,kotlin.Boolean)( value: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicatorColors, strokeWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, sweepAngle: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 360.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, reverseDirection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicator.composable#LevelIndicator(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.wear.compose.material3.LevelIndicatorColors,androidx.compose.ui.unit.Dp,kotlin.Float,kotlin.Boolean)` for screens that control a setting such as volume with either a rotating side button or rotating bezel. |

## Functions

### LevelIndicator

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/LevelIndicator.kt+function:LevelIndicator) Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.6.0)

```
@Composable
fun LevelIndicator(
    value: () -> Float,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    colors: LevelIndicatorColors = LevelIndicatorDefaults.colors(),
    strokeWidth: Dp = LevelIndicatorDefaults.StrokeWidth,
    sweepAngle: @FloatRange(from = 0.0, to = 360.0) Float = LevelIndicatorDefaults.SweepAngle,
    reverseDirection: Boolean = false
): Unit
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicator.composable#LevelIndicator(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.wear.compose.material3.LevelIndicatorColors,androidx.compose.ui.unit.Dp,kotlin.Float,kotlin.Boolean)` for screens that control a setting such as volume with either a rotating side button or rotating bezel.

Example of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicator.composable#LevelIndicator(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.wear.compose.material3.LevelIndicatorColors,androidx.compose.ui.unit.Dp,kotlin.Float,kotlin.Boolean)`:

```kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material3.IconButton
import androidx.wear.compose.material3.LevelIndicator
import androidx.wear.compose.material3.StepperDefaults
import androidx.wear.compose.material3.samples.icons.VolumeDownIcon
import androidx.wear.compose.material3.samples.icons.VolumeUpIcon

var value by remember { mutableFloatStateOf(0.5f) }
Box(modifier = Modifier.fillMaxSize()) {
    Column(
        verticalArrangement = Arrangement.SpaceEvenly,
        horizontalAlignment = Alignment.CenterHorizontally,
        modifier = Modifier.fillMaxSize(),
    ) {
        IconButton(
            modifier = Modifier.padding(horizontal = 16.dp),
            enabled = value < 1f,
            onClick = { value += 0.1f },
        ) {
            VolumeUpIcon(StepperDefaults.IconSize)
        }
        IconButton(
            modifier = Modifier.padding(horizontal = 16.dp),
            enabled = value > 0f,
            onClick = { value -= 0.1f },
        ) {
            VolumeDownIcon(StepperDefaults.IconSize)
        }
    }
    LevelIndicator(value = { value }, modifier = Modifier.align(Alignment.CenterStart))
}
```

![LevelIndicatorSample Composite
Image](https://developer.android.com/wear/images/design/WearComposeM3_LevelIndicatorSample_CompositeImage.png)

| Parameters |
|---|---|
| `value: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | Value of the indicator as a fraction in the range 0,1. Values outside of the range 0,1 will be coerced. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | Modifier to be applied to the component |
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Controls the enabled state of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicator.composable#LevelIndicator(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.wear.compose.material3.LevelIndicatorColors,androidx.compose.ui.unit.Dp,kotlin.Float,kotlin.Boolean)` - when false, disabled colors will be used. |
| `colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicatorColors = LevelIndicatorDefaults.colors()` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicatorColors` that will be used to resolve the indicator and track colors for this `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/LevelIndicator.composable#LevelIndicator(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.wear.compose.material3.LevelIndicatorColors,androidx.compose.ui.unit.Dp,kotlin.Float,kotlin.Boolean)` in different states |
| `strokeWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = LevelIndicatorDefaults.StrokeWidth` | The stroke width for the indicator and track strokes |
| `sweepAngle: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 360.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = LevelIndicatorDefaults.SweepAngle` | The angle covered by the curved LevelIndicator, in degrees |
| `reverseDirection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | Reverses direction of PositionIndicator if true |