Compose Playground

Slider

Allow users to make selections from a range of values.

Properties

Number of discrete values between min and max (0 means continuous).

Preview

Value: 0.50

Generated Code
import androidx.compose.material3.Slider
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier

@Composable
fun MySlider() {
    var sliderPosition by remember { mutableFloatStateOf(0.50f) }

    Slider(
        value = sliderPosition,
        onValueChange = { sliderPosition = it },
        valueRange = 0f..1f,
        
        enabled = true
    )
}