Wizard
NewMulti-step form with a progress header, sync or async validation per step and Back without losing input.
Installation
$ pnpm dlx shadcn@latest add @synccn/wizardFirst time in this project? Connect synccn with one command.
Usage
import { Wizard } from "@/components/ui/wizard";<Wizard steps={steps} onComplete={create} />API reference
Generated from the component's TypeScript types, so it always matches the code.
Wizard
Multi-step form: a step header with progress, one step at a time, validation (sync or async) before moving on, Back without losing anything, and focus moved to each new step.
- stepsrequired
WizardStep[]—
- step
numberControlled step index.
- defaultStep
numberDefault
0Step at first, when uncontrolled.
- onStepChange
(step: number) => void—
- onCompleterequired
() => unknownRuns after the last step validates. Return a promise to show a spinner.
- finishLabel
stringDefault
"Finish"Label on the last button.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Check, ChevronLeft, Loader2
Keyboard
- EnterContinue
Accessibility
- Focus moves to each new step's heading; the current step has aria-current="step" and errors use role alert.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: alert
- ARIA attributes: aria-current, aria-label, aria-labelledby
- Announces changes to screen readers