Stepper
Shows progress through numbered steps joined by lines; clicking a step makes it current.
Horizontal
ui.add(
Stepper::new(&mut state.horizontal)
.disabled(state.disabled)
.items([
StepperItem::new("Step 1"),
StepperItem::new("Step 2"),
StepperItem::new("Step 3"),
]),
);
Vertical
ui.add(
Stepper::new(&mut state.vertical)
.vertical(true)
.items((1..=4).map(|step| {
StepperItem::new(format!("Step {step}"))
.description(format!("Description for step {step}."))
})),
);
Text centre
ui.add(
Stepper::new(&mut state.centred)
.text_center(true)
.items((1..=3).map(|step| {
StepperItem::new(format!("Step {step}"))
.description(format!("Desc for step {step}."))
})),
);
Sizes
for size in [Size::XSmall, Size::Small, Size::Medium, Size::Large] {
let mut current = 1;
ui.add(Stepper::new(&mut current).size(size).items([
StepperItem::new("Account"),
StepperItem::new("Shipping"),
StepperItem::new("Payment"),
]));
}
Progress
let current = state.states;
ui.add(
Stepper::new(&mut state.states)
.completed_checks(true)
.item(StepperItem::new("Download"))
.item(StepperItem::new("Verify").loading(current == 1))
.item(StepperItem::new("Install").failed(current == 2))
.item(StepperItem::new("Restart")),
);
The story above is gallery/src/stories/stepper.rs, running in your browser. Every snippet on this page is cut from it.