Stepper allows users to make a selection from a range of values. It's a full-screen control
with increase button on the top, decrease button on the bottom and a slot (expected to have
either Text or Button) in the middle. Value can be increased and decreased by clicking on the
increase and decrease buttons. Buttons can have custom icons - decreaseIcon and increaseIcon.
Step value is calculated as the difference between min and max values divided by steps+1.
Stepper itself doesn't show the current value but can be displayed via the content slot or
StepperLevelIndicator if required. If value is not equal to any step value, then it will be
coerced to the closest step value. However, the value itself will not be changed and
onValueChange in this case will not be triggered. To add range semantics on Stepper, use
Modifier.rangeSemantics.
Android
@ComposablepublicfunStepper( value: Float, onValueChange:(Float)-> Unit, steps: Int, decreaseIcon:@Composable()-> Unit, increaseIcon:@Composable()-> Unit, modifier: Modifier = Modifier, enabled: Boolean =true, valueRange: ClosedFloatingPointRange<Float>=0f..(steps +1).toFloat(), colors: StepperColors = StepperDefaults.colors(), content:@Composable BoxScope.()-> Unit,)
Parameters
value
Current value of the Stepper. If outside of valueRange provided, value will be coerced to this range.
onValueChange
Lambda in which value should be updated.
steps
Specifies the number of discrete values, excluding min and max values, evenly distributed across the whole value range. Must not be negative. If 0, stepper will have only min and max values and no steps in between.
modifier
Modifiers for the Stepper layout.
decreaseIcon
A slot for an icon which is placed on the decrease (bottom) button.
increaseIcon
A slot for an icon which is placed on the increase (top) button.
enabled
Whether the Stepper is enabled.
valueRange
Range of values that Stepper value can take. Passed value will be coerced to this range.
colors
StepperColors that will be used to resolve the colors used for this Stepper. See StepperDefaults.colors.
content
Content body for the Stepper.
Android
@ComposablepublicfunStepper( value: Int, onValueChange:(Int)-> Unit, valueProgression: IntProgression, decreaseIcon:@Composable()-> Unit, increaseIcon:@Composable()-> Unit, modifier: Modifier = Modifier, enabled: Boolean =true, colors: StepperColors = StepperDefaults.colors(), content:@Composable BoxScope.()-> Unit,)
Parameters
value
Current value of the Stepper. If outside of valueProgression provided, value will be coerced to this range.
onValueChange
Lambda in which value should be updated.
valueProgression
Progression of values that Stepper value can take. Consists of rangeStart, rangeEnd and step. Range will be equally divided by step size.
modifier
Modifiers for the Stepper layout.
decreaseIcon
A slot for an icon which is placed on the decrease (bottom) button.
increaseIcon
A slot for an icon which is placed on the increase (top) button.
enabled
Whether the Stepper is enabled.
colors
StepperColors that will be used to resolve the colors used for this Stepper. See StepperDefaults.colors.