Skip to content
synccn

Wizard

New

Multi-step form with a progress header, sync or async validation per step and Back without losing input.

Step 1 of 3

Name your project

You can rename it later.

Installation

$ pnpm dlx shadcn@latest add @synccn/wizard

First 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
    number

    Controlled step index.

  • defaultStep
    number

    Default 0

    Step at first, when uncontrolled.

  • onStepChange
    (step: number) => void

    —

  • onCompleterequired
    () => unknown

    Runs after the last step validates. Return a promise to show a spinner.

  • finishLabel
    string

    Default "Finish"

    Label on the last button.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

  • lib/hooksuseControllable (works controlled or uncontrolled)
  • lib/utilscn (merges class names)

npm packages

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