A multi-step setup on the Stepper: validation before Next, Back, Skip for optional steps, a review step, a final success state and focus on the step heading. Each step is a form, so Enter in a field moves on. Works in a page or in a dialog.
On this page
- Workspace setup flow
- Model and key configuration
- Multi-step onboarding
- Review then finish form
- Resumable setup by URL
Examples
In a dialog
Installation
npx knowns-ui@latest add setup-wizardPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Setup wizard from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/setup-wizard
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add setup-wizard
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/stepper.tsx
- components/ui/knowns/blocks/setup/setup-wizard.tsx
- components/ui/knowns/blocks/setup/setup-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/setup-wizard, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "setup-wizard" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- steps
{ id, title, description?, optional?, validate?, children }[]- `validate` returns a message to stay on the step (sync or async). `optional` adds Skip and the stepper's Optional label.
- review
{ title?, description?, children }- A screen after the last step. Its Next button reads `finishLabel`.
- success
{ title, description?, action? }- Shown after `onFinish` resolves. Focus moves to its heading.
- onFinish
() => void|Promise<void>- Runs on the last screen. The button shows a spinner while it works.
- current / defaultCurrent / onCurrentChange
number- Default
0 - Controlled or uncontrolled step index. The review screen is index `steps.length`.
- syncUrl
string- A query parameter name, e.g. "step". Keeps `?step=<id>` in the address bar (replaceState) and reads it on load.
- variant
"card"|"plain"- Default
"card" - Plain drops the border and padding, for a dialog or your own panel.
- finishLabel
string- Default
"Finish" - The last button's label.
| Prop | Type | Default | Description |
|---|---|---|---|
| steps | { id, title, description?, optional?, validate?, children }[] | - | `validate` returns a message to stay on the step (sync or async). `optional` adds Skip and the stepper's Optional label. |
| review | { title?, description?, children } | - | A screen after the last step. Its Next button reads `finishLabel`. |
| success | { title, description?, action? } | - | Shown after `onFinish` resolves. Focus moves to its heading. |
| onFinish | () => void | Promise<void> | - | Runs on the last screen. The button shows a spinner while it works. |
| current / defaultCurrent / onCurrentChange | number | 0 | Controlled or uncontrolled step index. The review screen is index `steps.length`. |
| syncUrl | string | - | A query parameter name, e.g. "step". Keeps `?step=<id>` in the address bar (replaceState) and reads it on load. |
| variant | "card" | "plain" | "card" | Plain drops the border and padding, for a dialog or your own panel. |
| finishLabel | string | "Finish" | The last button's label. |
Next stays put and shows a red message (role="alert") when a step fails; the step turns red in the stepper. Finished steps in the stepper take you back. On narrow containers the stepper turns vertical.
What it handles
- 01Shows one step at a time under a Stepper, horizontal from 34rem of container width and vertical below it, with finished steps clickable to go back.
- 02Runs the step's `validate`, sync or async, on Next, stays put with an alert under the fields when it returns a message, and marks that step with an error.
- 03Submits each step as a form, so Enter in a field moves on, and sends focus to the step heading on every change but the first render.
- 04Marks a step `optional` to show Optional in the stepper and a Skip button, and keeps Back disabled on the first step.
- 05Adds a review screen after the last step with `review`, whose Next button reads `finishLabel`, then awaits `onFinish` with a spinner before the success screen.
- 06Runs controlled with `current` and `onCurrentChange` or on its own, and `syncUrl="step"` keeps ?step=<id> in the address bar and reads it on load.
States
- First render
- Nothing. The first step paints as it is, with no focus move
- none
- Next or Back
- The step panel swaps and focus moves to its heading
- none
- Validation fails
- An alert with the message appears and the step stays
- none
- Finish
- The button spins while onFinish runs, then the success text replaces the form
- none
- Stepper marks
- The stepper updates its own marks and lines
- none
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. The first step paints as it is, with no focus move | none |
| Next or Back | The step panel swaps and focus moves to its heading | none |
| Validation fails | An alert with the message appears and the step stays | none |
| Finish | The button spins while onFinish runs, then the success text replaces the form | none |
| Stepper marks | The stepper updates its own marks and lines | none |
Works with
- StepperInstalled with it. It draws the progress, the Optional label and the error mark.
- ButtonInstalled with it. Back, Next, Skip and Finish are its buttons, the submit one with the loading state.
- Onboarding checklistPairs with it: the checklist can link each step to a place in the wizard through syncUrl.
When to use
When to use
- A setup with several dependent steps, like connecting an account: validate, review, then confirm.
- The same flow in a page or inside a dialog.
When not to use
- A short list of first-run to-dos the user can do in any order: use Onboarding Checklist.
- Settings the user edits at any time: use Settings.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Setup Wizard to my app and wire it to my own data.
- I need a setup with several dependent steps, like connecting an account: validate, review, then confirm. Set that up with the Knowns UI Setup Wizard.
- Which Setup Wizard props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "setup-wizard" }) and search_docs({ query: "setup wizard" }).