Stepper
A Material step-by-step wizard: numbered steps; the current one shows its content and the "Continue" / "Cancel" buttons. Steps are children with
id:step
; a step's children become its content. Which step is current is decided by the markup through
currentStep
.
Type:
multi-child
@current:0
Stepper currentStep:$current onStepContinue:(){current = current + 1} onStepCancel:(){current = current - 1}
Column id:step title:"Email"
Text "Enter your address"
Column id:step title:"Password"
Text "Choose a password"
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
currentStep
|
int | 0 | Index of the current step, from zero |
type
|
string |
vertical
|
Layout:
vertical
or
horizontal
|
onStepTapped
|
callback
(step)
|
— |
A tap on a step header; the
step
argument is its index
|
onStepContinue
|
callback | — | The "Continue" button |
onStepCancel
|
callback | — | The "Cancel" button |
The argument of
onStepTapped
must be named exactly
step
: the value is passed by name, and
(i){…}
receives nothing.
Children
Every child with
id:step
is a step. Its parameters:
| Step parameter | Type | Description |
|---|---|---|
title
|
string | Step title (a string, not an element) |
subtitle
|
string | Caption under the title |
state
|
string |
Step icon:
indexed
(the number, default),
editing
,
complete
,
error
,
disabled
|
isActive
|
bool | Highlight the step as active |
Without a single
id:step
the element draws nothing.
Examples
Wizard with navigation by headers
@current:0
Stepper currentStep:$current onStepTapped:(step){current = step} onStepContinue:(){current = current + 1} onStepCancel:(){current = current - 1}
Column id:step title:"Account" subtitle:"email and password" state:complete isActive:true
Text "Done"
Column id:step title:"Profile" isActive:true
Text "Name and photo"
Column id:step title:"Confirmation"
Text "Check your details"
Horizontal
Stepper currentStep:1 type:horizontal
Column id:step title:"Cart" state:complete
Text "Done"
Column id:step title:"Delivery"
Text "Enter the address"
Column id:step title:"Payment"
Text "Choose a method"
Differences between the app and the site
On the site
Stepper
is drawn
static
: step numbers in circles (a check mark for
state:complete
), the title and the content of the current step (and of steps with
isActive:true
); for
type:horizontal
— a row of steps joined by lines with the content below. The "Continue"/"Cancel" buttons and
subtitle
are not drawn;
onStepTapped
,
onStepContinue
,
onStepCancel
are never called, and
currentStep:$current
is read once, when the page is built. The
editing
,
error
and
disabled
icons look the same on the site.
See also
- Column — the content of a step
- Progress indicators — progress without steps