---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Wizard

A flow the user goes through one step at a time, with back and next buttons, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Wizard`.

## Try it

Make a workspace in three steps. Continue with an empty name, a malformed address or a taken one (fieldwork, team, home) is refused with the reason on the step; a wrong email on the second step too. Back keeps what was typed; Create saves for a moment and ends on a finished state; Start again. Switch the head to the compact progress row.

The taken addresses are a list of three and the save is a timer; nothing is created or sent.

## When to use

- A flow the user goes through one step at a time, with back and next buttons.
- Also called: multi-step form or stepper.

## When not to use

- To only show where someone is in a flow, use Steps.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Wizard on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-wizard.json --yes
```

```text
Add the Goop Wizard to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { WizardIndicator } from '@/components/ui/goop/wizard';

import { useState } from 'react';
import { Alert, AlertTitle } from '@/components/ui/goop/alert';
import { Field } from '@/components/ui/goop/field';
import { TextInput } from '@/components/ui/goop/text-input';
import {
  Wizard,
  WizardFooter,
  WizardHeader,
  WizardNext,
  WizardPanel,
  WizardPrevious,
} from '@/components/ui/goop/wizard';

function ImportFlow() {
  const [step, setStep] = useState('file');
  const [file, setFile] = useState('');
  const [tried, setTried] = useState(false);
  return (
    <Wizard
      aria-label="Import notes"
      steps={[
        { value: 'file', label: 'File', complete: file !== '' },
        { value: 'check', label: 'Check' },
      ]}
      value={step}
      onValueChange={setStep}
    >
      <WizardHeader label="Import steps" />
      <WizardPanel
        value="file"
        title="Choose a file"
        alert={tried && !file ? <Alert variant="destructive"><AlertTitle>Name a file to import</AlertTitle></Alert> : null}
      >
        <ul>
          <Field as="li" label="File name">
            <TextInput value={file} onChange={(event) => setFile(event.target.value)} aria-invalid={tried && !file} />
          </Field>
        </ul>
      </WizardPanel>
      <WizardPanel value="check" title="Check the notes" description="Each file becomes one note." />
      <WizardFooter>
        <WizardPrevious />
        <WizardNext
          finishLabel="Import"
          onClick={(event) => {
            if (step !== 'file' || file) return;
            event.preventDefault();
            setTried(true);
          }}
        />
      </WizardFooter>
    </Wizard>
  );
}
```

- Fits: flow (its recipe).
- To refuse a move (Continue pressed while the step has errors), call `event.preventDefault()` in `WizardNext`'s `onClick`: the step stays, neither `onValueChange` nor `onFinish` is called, and that press shows why, in the step's `alert` and with `aria-invalid` on each refused field. When the flow can open at any step (a link, a saved draft, an Edit button), give each `steps` entry `complete` from what was filled, or every earlier step reads as done. A controlled wizard also stays put when its `onValueChange` does not pass the new value back.
- width, gap, corner, text: add no class for these.

## API reference

### Parts

- `WizardHeader` — The step strip at the top of a wizard, naming each step; use it or WizardIndicator, never both; its props: wizard--header.md
- `WizardPanel` — One step's content (title, description, fields); write one per step, matched to it by value; its props: wizard--panel.md
- `WizardFooter` — The row for WizardPrevious and WizardNext; write it once, as a direct child of the Wizard; its props: wizard--footer.md
- `WizardPrevious` — The back button, first in WizardFooter; it goes one step back and hides on the first step; its props: wizard--previous.md
- `WizardNext` — The forward button, last in WizardFooter; on the last step it finishes the flow; its props: wizard--next.md
- `WizardIndicator` — The flow's overall progress as a compact header, IN PLACE OF the `WizardHeader` (one or the other, never both); its props: wizard--indicator.md

- data-slot values (to select a part by): wizard, wizard-caption, wizard-footer, wizard-header, wizard-indicator, wizard-message, wizard-panel, wizard-panel-body, wizard-panel-description, wizard-panel-header

### WizardFooter

The row for WizardPrevious and WizardNext; write it once, as a direct child of the Wizard.

```tsx
import { WizardFooter } from '@/components/ui/goop/wizard';
```

### Options

- className?: string — Classes added to the foot's row.
- children?: ReactNode — The foot's buttons: a `WizardPrevious` and a `WizardNext`, the forward one last.

### WizardHeader

The step strip at the top of a wizard, naming each step; use it or WizardIndicator, never both.

```tsx
import { WizardHeader } from '@/components/ui/goop/wizard';
```

### Options

- label?: string = 'Steps' — The strip's name, read by assistive technology.
- className?: string — Classes added to the header's column, the strip and the children.
- children?: ReactNode — What follows the strip: the caller's own (never a `WizardIndicator`, which stands in place of the header).

### WizardIndicator

The flow's overall progress as a compact header, IN PLACE OF the `WizardHeader` (one or the other, never both).

```tsx
import { WizardIndicator } from '@/components/ui/goop/wizard';
```

### Options

- label?: string = 'Progress' — The bar's name, read by assistive technology.
- className?: string — Classes added to the row holding the caption and the bar.
- children?: string — The caption's words; "2/4" by default.

### WizardNext

The forward button, last in WizardFooter; on the last step it finishes the flow.

```tsx
import { WizardNext } from '@/components/ui/goop/wizard';
```

### Options

- finishLabel?: ReactNode = 'Finish' — The forward button's words on the last step.
- onFinish?: () => void — Called by a press on the last step, which moves nothing.
- onClick?: (event: MouseEvent<HTMLButtonElement>) => void — Runs first on a press; `event.preventDefault()` in it keeps the step (a step with errors).
- Also takes: type?: 'button' | 'submit' | 'reset' = 'button'; disabled?: boolean; loading?: boolean = false; loadingLabel?: string = 'Loading'

### Wizard: every option

```tsx
import { Wizard } from '@/components/ui/goop/wizard';
```

### Options

- steps: ReadonlyArray<WizardStep> — The flow as data, in order: each step's `value`, its `label` and `complete`.
- value?: string — The current step's `value`, when the caller holds it (with `onValueChange`).
- defaultValue?: string — The step shown first when the caller does not hold it.
- onValueChange?: (value: string) => void — Hears every move with the new step's `value`; a controlled wizard moves only when its caller passes it.
- State: value (value / defaultValue / onValueChange)
- Types: WizardStep = { value: string; label: string; complete?: boolean }

### WizardPanel

One step's content (title, description, fields); write one per step, matched to it by value.

```tsx
import { WizardPanel } from '@/components/ui/goop/wizard';
```

### Options

- value: string — The step this panel shows: a `value` of the wizard's `steps`.
- title: ReactNode — The step's title, a heading that names the panel.
- headingLevel?: 2 | 3 | 4 | 5 | 6 = 3 — The title's heading level, one under the heading the wizard stands under.
- description?: ReactNode — A line under the title.
- alert?: ReactNode — The caller's `Alert` before the fields: what needs a change before the step is left.
- className?: string — Classes added to the step's column.
- children?: ReactNode — The step's fields: a list of the theme's `Field` rows.

### WizardPrevious

The back button, first in WizardFooter; it goes one step back and hides on the first step.

```tsx
import { WizardPrevious } from '@/components/ui/goop/wizard';
```

### Options

- Also takes: type?: 'button' | 'submit' | 'reset' = 'button'; onClick?: (event: MouseEvent) => void; disabled?: boolean; loading?: boolean = false; loadingLabel?: string = 'Loading'

## Keyboard

- Tab: move through the step's fields and the foot's buttons
- Enter: press the focused button

## Accessibility

- The part itself answers the keys above.
- focus-visible: the browser's own (:focus-visible): write nothing

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Steps](/themes/meadow/components/steps): A strip that shows which step of a flow the user is on, for display only.
- [Alert](/themes/meadow/components/alert): A message about the state of something that stays inline in the page until it changes.
- [Field](/themes/meadow/components/field): A form row that ties one control to its label and its description, as a settings row or a stacked form field.
- [Text input](/themes/meadow/components/text-input): A single-line field for free words, such as a task's title, a name or an email.
