RangeSlider

fun RangeSlider(value: ClosedFloatingPointRange<Float>, onValueChange: (ClosedFloatingPointRange<Float>) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, valueRange: ClosedFloatingPointRange<Float> = 0f..1f, @IntRange(from = 0) steps: Int = 0, onValueChangeFinished: () -> Unit? = null, height: Dp = SliderDefaults.MinHeight, colors: SliderColors = SliderDefaults.sliderColors(), hapticEffect: SliderDefaults.SliderHapticEffect = SliderDefaults.DefaultHapticEffect, showKeyPoints: Boolean = false, keyPoints: List<Float>? = null, magnetThreshold: Float = 0.02f)

A RangeSlider component with Miuix style.

Range Sliders expand upon Slider using the same concepts but allow the user to select 2 values. The two values are still bounded by the value range but they also cannot cross each other.

Parameters

value

Current values of the RangeSlider. If either value is outside of valueRange provided, it will be coerced to this range.

onValueChange

Lambda in which values should be updated.

modifier

The modifier to be applied to the RangeSlider.

enabled

Whether the RangeSlider is enabled.

valueRange

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

steps

If positive, specifies the amount of discrete allowable values between the endpoints of valueRange.

onValueChangeFinished

Lambda to be invoked when value change has ended.

height

The height of the RangeSlider.

colors
hapticEffect

The haptic effect of the RangeSlider.

showKeyPoints

Whether to show the key points (step indicators) on the slider. Only works when keyPoints is not null.

keyPoints

Custom key point values to display on the slider. If null, uses step positions from steps parameter. Values should be within valueRange.

magnetThreshold

The magnetic snap threshold as a fraction (0.0 to 1.0). When the slider value is within this distance from a key point, it will snap to that point. Default is 0.02 (2%). Only applies when keyPoints is set.