Ask Rift AI
Theme: Smoke
Layout: Contained
Background: Field
Search or ask anythingAsk Rift AI
Theme: Smoke
Layout: Contained
Background: Field
Colour mode: System

Wizard

A task in steps

Wizard puts a stepper above the step in front of the reader, its fields under their own heading, and Back and Continue at the foot beside a running summary. Moving to a step moves focus to its heading, so a screen reader hears where it landed, and the host holds Continue until the step’s fields pass.

Default

  1. TeamWho works on it
  2. ReviewCheck and confirm

Details

Alternatives

  • Use Stepper instead when only the progress is needed and the host lays out the steps and their buttons.

Props

Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.

Wizard props
PropTypeDefaultDescription
steps*
WizardStep[]
The steps, in order.
step
number
The index of the step shown, for a controlled wizard. Leave it undefined to let the wizard keep its own, seeded from `defaultStep`.
defaultStep
number
0
The step shown on first render when the wizard is uncontrolled. Defaults to 0.
onStepChange
((step: number) => void)
Fires with the index of the step the reader moves to, by Back, Continue or a completed step in the stepper.
onFinish
(() => void)
Called when the reader presses the last step's finish button.
canAdvance
boolean
true
Whether the reader can move on from the step shown: false holds Continue and Finish, while the step's own fields say what is missing. Defaults to true.
summary
ReactNode
A running figure at the start of the footer, kept in view as the steps change: a total, a count of what is chosen.
allowStepClick
boolean
true
Lets the reader go back to a completed step from the stepper. Defaults to true.
backLabel
string
'Back'
The back button's text. Defaults to "Back".
nextLabel
string
'Continue'
The next button's text. Defaults to "Continue".
finishLabel
string
'Finish'
The last step's button text. Defaults to "Finish".
locale
string
The BCP 47 locale the stepper's step numbers are written in. Defaults to the nearest LocaleProvider's, else `en-US`.
headingLevel
2 | 4 | 3
2
The step heading's place in the outline. Defaults to 2, a section of a page.
className
string
''
Additional CSS classes

Keys

Back, Continue and Finish are native buttons, as are the stepper’s completed steps, and focus moves to each step’s heading. Those keys belong to the platform, so no test of this library presses them.

tsx
// From the npm package
import { Wizard } from 'rift-ds/components/Wizard/Wizard';

// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/wizard.json

3.4 kB gzipped, with everything it imports. Peer dependencies are not counted.

For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.