Stepper
Use the Stepper component for a multistep flow in a fixed order, such as a creation wizard. It gives users an overview of all steps and guides them through the steps one by one. Create it with createStepper.
See Accessibility in Design Foundations for explanations of key concepts and best practices.
Keyboard accessibility and focus
The step list has one tab stop: the current step. Use the arrow keys to move focus between steps, and press Tab to leave the list.
| Key | Behavior |
|---|---|
| Up, Left | Moves focus to the previous step. |
| Down, Right | Moves focus to the next step. |
| Enter, Space | Selects the focused step. Does nothing on a disabled step. |
After a step change, the Stepper moves focus to the first focusable element in the new step's content. If the content has none, focus goes to the first button in the footer.
When Next or Finish is refused, focus stays on the button that was pressed. If Finish sends the user to another step, focus moves into that step's content instead.
- Don't move focus yourself after a step change. The
Stepperalready moves it into the new step.
Accessible names and roles
The Stepper marks the current step with aria-current="step". A disabled step is marked aria-disabled. It stays reachable with the arrow keys, so screen reader users can find it and hear that it is unavailable.
- Do give every step a short, distinct
Stepper.Title. It names the step in the list and in its panel. - Do add
aria-label,aria-labelledby, oraria-describedbyonStepper.Steponly when the title is not descriptive enough.
State announcements
The Stepper announces changes through live regions. You do not need to add your own.
| Event | Announcement |
|---|---|
| The step changes | A polite message, "Step X of N". |
Next or Finish is refused | An assertive message that names the step. It does not quote your error text. |
Finish is refused and sends the user to another step | The same message, plus how many steps still need attention. The count is left out when onComplete returns the step to go to. |
| An async check is pending | A polite "Loading" message. |
The step list does not rely on color or icons alone. A step with the status invalid or valid also gets the hidden text "(error)" or "(complete)".
- Do show your error text next to the field, for example with
FormFieldMessages.Item. TheStepperannounces which step needs attention, but it does not read your message. - Do set a
Stepper.ErrorMessageso the step list explains the error as well.