androidx.compose.material3

SliderState

Class

No hand-written docs yet.

Class that holds information about Slider's active range.

class SliderState(
    value: Float = 0f,
    steps: Int = 0,
    onValueChangeFinished: (() -> Unit)? = null,
    valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
) : DraggableState

Is a

How to get one

Create it

Ready-made values and functions that return it

Used by

Parameters that take a SliderState.

Properties

value

val value: Float

Float that indicates the value that the thumb currently is in respect to the track.

onValueChangeSince 1.9

val onValueChange: ((Float) -> Unit)?

Callback in which value should be updated.

shouldAutoSnapSince 1.9

val shouldAutoSnap: Boolean

Controls the auto-snapping mechanism, disabling it may be useful for custom animations.

coercedValueAsFractionSince 1.9

val coercedValueAsFraction: Float

The fraction of the track that the thumb currently is in.

isDraggingSince 1.9

val isDragging

steps

val steps: Int

onValueChangeFinished

val onValueChangeFinished: (() -> Unit)?

valueRange

val valueRange: ClosedFloatingPointRange<Float>

Functions

SaverSince 1.9

fun Saver(
    onValueChangeFinished: (() -> Unit)?,
    valueRange: ClosedFloatingPointRange<Float>,
): Saver<SliderState, *>

The default Saver implementation for SliderState.

Library docs

Class that holds information about Slider's active range.