rememberSliderState

Functions summary

SliderState
@Composable
rememberSliderState(
    value: Float,
    steps: @IntRange(from = 0) Int,
    trackRange: ClosedFloatingPointRange<Float>
)

Creates a SliderState that is remembered across compositions.

Cmn

Functions

rememberSliderState

@Composable
fun rememberSliderState(
    value: Float = 0.0f,
    steps: @IntRange(from = 0) Int = 0,
    trackRange: ClosedFloatingPointRange<Float> = 0f..1f
): SliderState

Creates a SliderState that is remembered across compositions.

Changes to the provided initial values will not result in the state being recreated or changed in any way if it has already been created.

Parameters
value: Float = 0.0f

Float that indicates the initial position of the thumb. If outside of trackRange provided, value will be coerced to this range.

steps: @IntRange(from = 0) Int = 0

if positive, specifies the amount of discrete allowable values between the endpoints of trackRange. For example, a range from 0 to 10 with 4 steps allows 4 values evenly distributed between 0 and 10 (i.e., 2, 4, 6, 8). If steps is 0, the slider will behave continuously and allow any value from the range. Must not be negative.

trackRange: ClosedFloatingPointRange<Float> = 0f..1f

range of values that Slider values can take. value will be coerced to this range.