API reference

Slider Composable

Displays a continuous value control with optional contextual hints.
Use labels or icons at the ends to communicate direction, such as quiet/loud or low/high brightness. The thumb remains visible and interactive at every SliderSize, while thumbIcon is rendered only for SliderSize.Large.

Signature

@Composable
fun Slider(
    value: Float,
    onValueChange: (Float) -> Unit,
    modifier: Modifier = Modifier,
    contentDescription: String? = null,
    enabled: Boolean = true,
    size: SliderSize = SliderSize.Medium,
    onValueChangeFinished: () -> Unit? = null,
    thumbIcon: @Composable () -> Unit? = null,
    startLabel: String? = null,
    endLabel: String? = null,
    startIcon: @Composable () -> Unit? = null,
    endIcon: @Composable () -> Unit? = null,
    valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
    colors: SliderColors = SliderDefaults.Colors,
    dimensions: SliderDimensions = UiSetTheme.dimensions.sliders,
)

Parameters

value: Float current value within valueRange
onValueChange: (Float) -> Unit callback receiving values when the user clicks or drags
modifier: Modifier modifier applied to the slider and its hints
contentDescription: String? accessibility label for the controlled value
enabled: Boolean whether the slider accepts input
size: SliderSize visual track and thumb size
onValueChangeFinished: (() -> Unit)? callback invoked after click, drag, or semantic adjustment completes
thumbIcon: (@Composable () -> Unit)? optional icon displayed inside a SliderSize.Large thumb
startLabel: String? optional text below the start of the track
endLabel: String? optional text below the end of the track
startIcon: (@Composable () -> Unit)? optional icon preceding startLabel
endIcon: (@Composable () -> Unit)? optional icon preceding endLabel
valueRange: ClosedFloatingPointRange inclusive range represented by the track
colors: SliderColors active, inactive, icon, and disabled colors
dimensions: SliderDimensions track, thumb icon, hint icon, and spacing geometry