Components / navigation
Wizard builder
A multi-step flow: the steps, the current step's body, and the way on.
A builder is RenderOnce. Construct and mount it in one expression.
use gpui_kit::navigation::Wizard;
Reviewed in wizard.
Construct
new(ident: impl Into<Ident>) -> Self
Options
Chain onto the value.
step(step: WizardStep) -> Self
steps(steps: impl IntoIterator<Item = WizardStep>) -> Self
layout(layout: WizardLayout) -> Self
vertical() -> Self
body(body: impl IntoElement) -> Self
back_to(step: impl Into<SharedString>) -> Self
finish(finish: bool) -> Self
can_advance(can_advance: bool) -> Self
back_label(label: impl Into<SharedString>) -> Self
next_label(label: impl Into<SharedString>) -> Self
finish_label(label: impl Into<SharedString>) -> Self
on_navigate(handler: impl Fn(&WizardIntent, &mut Window, &mut App) + 'static) -> Self
Example · wizard
fn wizard(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
stack(&theme)
.w(px(720.0))
.child(caption(
&theme,
"horizontal, with a blocked step and a failed one",
))
.child(
Wizard::new("scene.wizard.release")
.steps([
WizardStep::new("prepare", "Prepare")
.description("Check the workspace is clean")
.complete(),
WizardStep::new("build", "Build")
.description("Compile every target")
.failed("The build failed on the test target."),
WizardStep::new("sign", "Sign").current(),
WizardStep::new("publish", "Publish")
.blocked("Approval is required for this workspace."),
])
.body(crate::foundation::text(
&theme,
TypeScale::Body,
SharedString::new_static("The body of the current step belongs to the caller."),
))
.back_to("build")
.on_navigate(|_, _, _| {}),
)
.child(caption(&theme, "vertical, finishing"))
.child(
Wizard::new("scene.wizard.setup")
.vertical()
.steps([
WizardStep::new("account", "Account").complete(),
WizardStep::new("workspace", "Workspace").complete(),
WizardStep::new("review", "Review").current(),
])
.back_to("workspace")
.finish(true)
.on_navigate(|_, _, _| {}),
)
.into_any_element()
}