Skip to main content

CamoStepper

A whole-number quantity with − and + buttons: cart lines, guests. The buttons disable at the ends of range, and holding one repeats, faster over time. With allowTyping the value is a number field, clamped to range and snapped to step when focus leaves. Screen readers get three stops: "Decrease label", the value, and "Increase label"; each change is announced. valueText formats the value ("3 nights").

API​

public fun CamoStepper(
value: Int,
onValueChange: (Int) -> Unit,
modifier: Modifier = Modifier,
range: IntRange = 0..Int.MAX_VALUE,
step: Int = 1,
label: String? = null,
allowTyping: Boolean = true,
valueText: ((Int) -> String)? = null,
error: String? = null,
enabled: Boolean = true,
)
NameTypeDefault
valueIntrequired
onValueChange(Int) -> Unitrequired
modifierModifierModifier
rangeIntRange0..Int.MAX_VALUE
stepInt1
labelString?null
allowTypingBooleantrue
valueText((Int) -> String)?null
errorString?null
enabledBooleantrue
Design notes

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