Stepper
Shows where the user is in a process of several steps. Done steps get a check, the current one is ringed and the line between them fills as you advance. on_select lets the user go back to a step.
ui.stepper · Category: Navigation · Full reference →


pz.container(ui.stepper(["Cart", "Address", "Payment", "Done"], 2, on_step), width=520)When to use
Section titled “When to use”- For sign-ups, checkouts, installers and other wizards.
- For sections the user can open in any order, use a Tab bar.
import pyzed as pzfrom pyzed import ui
class Checkout(pz.App): def __init__(self): self.step = 0
def view(self): return pz.column([ ui.stepper(["Cart", "Address", "Payment"], self.step, lambda i: setattr(self, "step", i)), ui.button("Next", lambda: setattr(self, "step", min(self.step + 1, 3)), variant="solid"), ], spacing=16)Variants
Section titled “Variants”Options
Section titled “Options”

Code
pz.container(ui.stepper(["Cart", "Address", "Payment"], 1, on_step), width=420)

vertical=TrueCode
ui.stepper([("Account", "Name and email"), ("Address", "Where it goes"), ("Payment", "Card or transfer")], 1, on_step, vertical=True)

tint="success"Code
pz.container(ui.stepper(["Upload", "Check", "Publish"], 3, on_step, tint="success"), width=420)States and events
Section titled “States and events”![Stepper: errors=[1]](/pyzed/library/stepper-v2-1.dark.webp)
![Stepper: errors=[1]](/pyzed/library/stepper-v2-1.light.webp)
errors=[1]Code
pz.container(ui.stepper(["Cart", "Address", "Payment"], 1, on_step, errors=[1]), width=420)

Code
pz.container(ui.stepper(["One", "Two", "Three"], 0), width=420)Events
Section titled “Events”Stepper has 1 event of its own, listed below. Like every widget it also has the 18 common events (click, double_click, right_click, mouse_enter, drag, key_down, resize…), attached with .on(...): see Events and Events of every component.
| Event | Handler gets | When |
|---|---|---|
on_select |
(index) |
Called with the index of a clicked step. |
Handler gets is what Pyzed passes to your callable: () means nothing. Any handler can also be a message (a value that is not callable), which goes to update().
Handling the events
Section titled “Handling the events”The same events written three ways. Imperative: methods of the app change self. Declarative: the handlers produce messages and one update() decides. Functional: a pure function draws an immutable state and asks for changes with set_state(...). See Imperative, declarative and functional.
class Checkout(pz.App): def __init__(self): self.step = 1
def go(self, index): # on_select: the index of the clicked step self.step = index
def view(self): return pz.column([ ui.stepper(["Cart", "Address", "Payment", "Done"], self.step, self.go), ui.button("Next", lambda: self.go(min(self.step + 1, 4)), variant="solid"), ], spacing=16)from dataclasses import dataclass
@dataclassclass GoTo: index: int
class Checkout(pz.App): step = 1
def update(self, message): match message: case GoTo(index): self.step = index
def view(self): return ui.stepper(["Cart", "Address", "Payment"], self.step, GoTo)from dataclasses import dataclass
@dataclass(frozen=True)class State: step: int = 1
def view(state, set_state): return ui.stepper(["Cart", "Address", "Payment"], state.step, lambda index: set_state(step=index))Properties and API
Section titled “Properties and API”ui.stepper
Section titled “ui.stepper”stepper( steps, current, on_select=None, *, vertical=False, linear=True, errors=(), tint='accent', theme=None,)The steps of a wizard or a checkout: done ones get a check, the current one is ringed and the line between them fills as you advance.
| Property | Default | Description |
|---|---|---|
steps |
required | Titles or (title, description) tuples. |
current |
required | Index of the step in progress (len(steps) once all are done). |
vertical |
False |
Stacks the steps, with each description under its title. |
linear |
True |
Only done steps and the current one can be clicked. |
errors |
() |
Indexes of steps drawn in the error color. |
tint |
"accent" |
Color of the done steps and the line. |
theme |
None |
Theme to use instead of the current one (pyzed.theme.current()). |
Events: on_select (events).