Slider

fun Slider(value: Float, onValueChange: (Float) -> Unit, modifier: Modifier = Modifier, valueRange: ClosedFloatingPointRange<Float> = 0f..1f, onValueChangeFinished: () -> Unit? = null, enabled: Boolean = true, rounded: Boolean = false, steps: Int = 0, intent: SliderIntent = SliderIntent.Basic, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Spark slider. Sliders allow users to make selections from a range of values. Sliders reflect a range of values along a bar, from which users may select a single value. They are ideal for adjusting settings such as volume, brightness, or applying image filters.

Parameters

value

current value of the slider. If outside of valueRange provided, value will be coerced to this range.

onValueChange

callback in which value should be updated

modifier

the Modifier to be applied to this slider

valueRange

range of values that this slider can take. The passed value will be coerced to this range.

onValueChangeFinished

called when value change has ended. This should not be used to update the slider value (use onValueChange instead), but rather to know when the user has completed selecting a new value by ending a drag or a click.

enabled

controls the enabled state of this slider. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

steps

if greater than 0, specifies the amount of discrete allowable values, evenly distributed across the whole value range. If 0, the slider will behave continuously and allow any value from the range specified. Must not be negative.

intent

The intent color for the Slider.

interactionSource

the MutableInteractionSource representing the stream of Interactions for this slider. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this slider in different states.