Skip to main content

CamoSlider

A value from a continuous or stepped range: volume, a price filter. A tap jumps to the touched value and a drag follows the finger; steps stops lie between the ends (0 = continuous). onValueChangeFinished fires once per gesture or key press, so an app can save once. label names it for screen readers ("Volume"), and valueLabel gives the value's text, shown on the thumb while dragging. The parent sets the width.

API​

public fun CamoSlider(
value: Float,
onValueChange: (Float) -> Unit,
modifier: Modifier = Modifier,
range: ClosedFloatingPointRange<Float> = 0f..1f,
steps: Int = 0,
onValueChangeFinished: (() -> Unit)? = null,
valueLabel: ((Float) -> String)? = null,
label: String? = null,
enabled: Boolean = true,
interactionSource: MutableInteractionSource? = null,
)
NameTypeDefault
valueFloatrequired
onValueChange(Float) -> Unitrequired
modifierModifierModifier
rangeClosedFloatingPointRange<Float>0f..1f
stepsInt0
onValueChangeFinished(() -> Unit)?null
valueLabel((Float) -> String)?null
labelString?null
enabledBooleantrue
interactionSourceMutableInteractionSource?null
Design notes

Why CamoSlider works this way, its states and its edge cases: contributor docs.