# Wizard with progress and review

URL: https://docs.forms.saastro.io/docs/recipes/wizard-progress-review
> A multi-step form with a progress indicator and a final review step that lists the answers by step, each with an Edit button that goes back to it.

# Wizard with progress and review

## What it combines

- **`FormConfig.stepsUi`** — a progress bar, dots, numbered steps or a sidebar, drawn by `<Form />` ([Multi-Step Forms](/docs/multi-step))
- **`stepsUiPlugin()`** from `@saastro/forms/steps` — without it `stepsUi` draws nothing
- **A review step** — `Step.review` (`StepBuilder#review()`), a step with no fields that summarises the previous ones
- **`goToStep`** — what each Edit button on the review uses to return to its step

```tsx
import { FormBuilder, PluginManager } from '@saastro/forms';
import { stepsUiPlugin } from '@saastro/forms/steps';

/**
 * Three steps, a progress bar and a final review. The bar comes from `stepsUi` (it needs
 * `stepsUiPlugin()` registered); the review is a step flagged `review`, which draws the earlier
 * answers by step, each with an Edit button that goes back to that step with `goToStep`.
 */
export function createConfig() {
  const plugins = new PluginManager();
  plugins.register(stepsUiPlugin());

  const config = FormBuilder.create('wizard-review')
    .layout('manual')
    .columns(12)
    .addField('name', (f) => f.type('text').label('Full name').required().columns({ default: 12 }))
    .addField('email', (f) =>
      f.type('email').label('Email').required().email().columns({ default: 12 }),
    )
    .addField('plan', (f) =>
      f
        .type('radio')
        .label('Plan')
        .required()
        .options([
          { value: 'starter', label: 'Starter' },
          { value: 'team', label: 'Team' },
        ])
        .columns({ default: 12 }),
    )
    .addField('notes', (f) =>
      f.type('textarea').label('Anything else?').optional().rows(3).columns({ default: 12 }),
    )
    .step('about', 'About you', (s) => s.fields('name', 'email').defaultNext('plan'))
    .step('plan', 'Your plan', (s) => s.fields('plan', 'notes').defaultNext('review'))
    // Last step, no fields of its own: it summarises the ones before it.
    .step('review', 'Review', (s) => s.fields().review())
    .initialStep('about')
    .usePlugins(plugins)
    .build();

  return {
    ...config,
    // `navigable` lets the visitor go back to steps already visited from the bar itself.
    stepsUi: { mode: 'progress' as const, variant: 'steps' as const, navigable: true },
  };
}
```

## The code

The **Code** tab above is the whole form. The two pieces that matter are the plugin plus `stepsUi`, and the last step:

```ts
plugins.register(stepsUiPlugin());

.step('review', 'Review', (s) => s.fields().review())

// after build():
{ ...config, stepsUi: { mode: 'progress', variant: 'steps', navigable: true } }
```

## How it works

- **The review is just a step** — put it last, usually with `fields: []`. It prints one block per step on the visitor's real path, computed from the current values.
- **Edit returns to that step** with `goToStep`; the review is recomputed from the current values when the visitor comes back.
- **`navigable`** lets the visitor jump to a step already visited (the same as `FormRef.goToStep`).
- **`stepsUi` is configuration, not builder**: the builder has no method for it, so spread it onto the built config (or write it in the JSON config).

## Caveats

- **Register the plugin** — `stepsUi` without `stepsUiPlugin()` draws nothing and logs one warning per form. `<Form />` never imports `/steps`, so forms without a progress bar do not pay for it.
- **Empty answers are not listed**, and a block with nothing says so. Hidden fields and resolvers, the consent checkbox, files and signatures are left out, by the same rule as the WhatsApp summary.
- **Conditional routing still applies** — after an edit, a branch that no longer applies loses its block, because the review follows the path and not the history.
- **Texts follow the form's locale** (`en`/`es` built in); override them with `setDefaultMessages`.

## Variations

- `variant: 'bar'` or `'dots'` for a lighter indicator; `mode: 'sidebar'` for a vertical menu.
- `mode: 'none'` and your own component through a plugin's `stepsUi` if you need a different look.

## Related

- [Multi-Step Forms](/docs/multi-step)
- [Multi-step lead form with a webhook](/docs/recipes/multi-step-webhook)
- [Save and continue later](/docs/recipes/save-and-continue)
