Stepper
Show a process with discrete steps.
Try it
Interact with the control below. This preview runs the exact code sample shown on this page.
Advance and reset
use gpui::{Context, Entity, Render, Window, div, prelude::*};
use xgpui_luma::controls::{button::Button, stepper::Stepper};
use xgpui_luma::infra::presenter::HasPresenter;
use xgpui_luma_look_radix as radix;
struct Example {
stepper: Stepper,
next: Entity<Button>,
reset: Entity<Button>,
}
impl Example {
fn new(cx: &mut Context<Self>) -> Self {
let look = cx.try_global::<radix::Look>().cloned().unwrap_or_else(radix::Look::built_in);
let stepper = radix::stepper_builder(&look, "setup", 3)
.labels(vec!["Details", "Review", "Done"])
.spawn(cx);
let next = radix::Button::new("next").look(&look).label("Next / Finish")
.on_click(cx, |owner: &mut Self, cx| {
owner.stepper.update(cx, |stepper, cx| {
let next = stepper.current_step() + 1;
if next < stepper.step_count() {
stepper.set_current_step(next, cx);
} else {
stepper.complete(cx);
}
});
})
.spawn(cx);
let reset = radix::Button::new("reset").look(&look).label("Reset")
.on_click(cx, |owner: &mut Self, cx| {
owner.stepper.update(cx, |stepper, cx| stepper.set_current_step(0, cx));
})
.spawn(cx);
Self { stepper, next, reset }
}
}
impl Render for Example {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
div().flex().flex_col().gap_3()
.child(self.stepper.clone())
.child(div().flex().gap_2().child(self.next.clone()).child(self.reset.clone()))
}
}Render this view in an initialized Luma application. Next advances through the three steps; another click completes the workflow. Reset returns to the first step.
Radix styling
stepper_builder(&look, id, step_count) installs Radix status, connector, and badge styling. SDK labels, direction, completion, state overrides, sizes, content, and motion remain available.
Pass an explicit Look, including forks. Theme adapters retain that binding; notify affected controls and their owners after palette, mode, or stylesheet edits. Resolved look values are snapshots and must be resolved again during render.
See the Radix control support table for adapter and utility status.
SDK behavior & customization
Configure step count, current step, labels, and direction. It is a process indicator rather than Tabs.
Relevant contracts: StepperRenderModel, StepperTemplateModifier, StepperTemplate, ThemedStepperTemplate.
Use the module’s template contract for structural changes. Builder modifiers and item templates vary by control.
Application interaction
Stepper has no events of its own. Button’s on_click handlers drive it here. Indices start at zero; set_current_step derives each badge’s state, complete marks all steps complete, and setting a step again clears completion.