Skip to content

Wizard

Multi-step form wizard with validation and navigation.

Props

WizardProps<T>

PropTypeRequiredDescription
stepsWizardStep<T>[]YesStep definitions
initialDataTYesInitial form data
onComplete(data: T) => void | Promise<void>YesCompletion callback
onStepChange(step: number) => voidNoStep change callback
classNamestringNoContainer class

WizardStep<T>

PropertyTypeRequiredDescription
idstringYesStep identifier
titlestringYesStep title
descriptionstringNoStep description
componentComponentType<WizardStepProps<T>>YesStep component
validate(data: T) => boolean | Promise<boolean>NoValidation function

WizardStepProps<T>

Props passed to step components:

PropertyTypeDescription
dataTCurrent form data
updateData(partial: Partial<T>) => voidUpdate data
errorsRecord<string, string>Validation errors

Compound Components

  • Wizard.Header — Step indicator
  • Wizard.Content — Current step content
  • Wizard.Footer — Navigation buttons

Example

tsx
const steps: WizardStep<FormData>[] = [
  { id: 'info', title: 'Basic Info', component: BasicInfoStep },
  { id: 'details', title: 'Details', component: DetailsStep },
  { id: 'review', title: 'Review', component: ReviewStep },
]

<Wizard
  steps={steps}
  initialData={{ name: '', email: '' }}
  onComplete={handleSubmit}
>
  <Wizard.Header />
  <Wizard.Content />
  <Wizard.Footer />
</Wizard>

See also