Wizard
A task split into steps, one on screen at a time, under an indicator that shows where the user is.
Installation
Wizard depends on Icon, which gives the check its color. dolan add installs it automatically.
Usage
- Each
<ui-wizard-step>is a step. Itslabelgoes under its number in the indicator, and its content shows while it's the current step. stepcounts from 0.[(step)]keeps your signal in step with the wizard.- The buttons are yours. What they say, and what must be valid before going on, differ with every wizard.
#wizardlets the template call the wizard.
More than three steps
A wizard takes any number of steps. The indicator shows three at a time: the current step and the two after it.
- A line that fades out means more steps that way. With steps still to come, the line past the third fades. Once the first step is done, the line before the steps on show fades too.
- The steps slide along as each is finished. After step 1 the indicator shows 2, 3 and 4.
- The last three stay to the end. With nothing more to slide in, they fill in with checks.
With three steps or fewer, all of them show and nothing slides.
Move between steps
To hold the user on a step until it's valid, disable your button:
Steps keep their state
Every step stays rendered, and the ones off screen are hidden rather than removed. So what the user typed in a step is still there when they go back to it.
The new step slides in from the side the wizard moved from: the right going on, the left going back.
Spacing
The wizard leaves 24px between the indicator and the step. Change it with a gap class:
Only the indicator
When the steps' content lives elsewhere, such as one routed screen per step, leave the steps empty and drop the gap:
A step needs no label either: the indicator then shows its number alone.
API
UiWizard
A step past the last step shows the last one.
UiWizardStep
No outputs. A label longer than its step is wide wraps onto a second line, then ends in an ellipsis.
The file also exports the WizardStepLabel and WizardStepState types.
Accessibility
-
The indicator is one element to a screen reader, read as "Step 2 of 5: Profile". Its numbers and labels aren't read one by one.
-
Translate it with
stepLabel, a function of the step (counted from 1), the number of steps and the step's label: -
Reduce Motion: the indicator and the steps change at once, with no sliding or fading.
Related
- Tabs: panels the user can switch between in any order
- Progress: a bar for progress that isn't in steps
- Pagination: page numbers with previous and next buttons
