← Back to Material Compose
RangeSlider
Component
in
Material
. Since 1.0.0Overview
Examples
Community Notes
<a href="https://material.io/components/sliders" class="external" target="_blank">Material Design slider</a>.
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.
Use continuous Range Sliders to allow users to make meaningful selections that don’t require a specific values:
Overloads
RangeSlider
@Composable
@ExperimentalMaterialApi
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,
colors: SliderColors = SliderDefaults.colors()
)
Parameters
Name | Description |
---|---|
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 | modifiers for the Range Slider layout |
enabled | whether or not component is enabled and can we interacted with or not |
valueRange | range of values that Range Slider values can take. Passed value will be coerced to this range |
steps | if greater than 0, specifies the amounts of discrete values, evenly distributed between across the whole value range. If 0, range slider will behave as a continuous slider and allow to choose any values from the range specified. Must not be negative. |
onValueChangeFinished | lambda to be invoked when value change has ended. This callback shouldn't be used to update the range slider values (use onValueChange for that), but rather to know when the user has completed selecting a new value by ending a drag or a click. |
colors | SliderColors that will be used to determine the color of the Range Slider parts in different state. See SliderDefaults.colors to customize |
Previous Component← RadioGroup
Next ComponentRippleIndication →