Wizard
A multi-step form shell: a progress bar, completed steps you can jump back to, panes that glide while the card’s height morphs, the form’s own validation on every hop (shake, error, focus) and a review pane that reads the answers back from the controls.
Real scenarios
The component as it is used in a product — not a specimen grid.
Setting up a workspace
“Next” refuses to move until the step in view passes the form’s own validation — try it with an empty name: the pane shakes, the footer error lights up and the first bad field takes focus. Completed steps jump back from the bar above, and the review pane reads every answer back from the controls themselves (data-nx-summary names each question). The final submit re-enables all panes first, so nothing is dropped — and the wire:model inputs ride along in the demo’s state.
The wizard is a plain <form>: attributes land on the root, so wire:submit (or a real action) works — the submit button knows the action through wire:target and spins for the length of the request.
A workshop signup without the review pane
With :review="false" the last step is the last step — the footer button becomes the submit, here renamed to “رزرو جای من” through the labels array (invalid message included). These steps carry no ids, so their slots are the numbered ones: step1, step2, …
The hop is still validated: try reserving with an empty email and the pane refuses in this instance’s own words.
Resuming a half-filled draft
step="1" drops the user on the second pane: the first step renders as completed (its jump button is live), the answers are already in the controls, and the review pane reads them back — exactly what a “continue where you left off” needs.
An nx-step-change event bubbles on every hop (carrying the step index) and nx-submit fires right before the form goes out — both are yours to listen to on the root.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| steps | array | [] | Each step: ['id' => …, 'title' => …, 'description' => …]; its fields go in the slot named step + the StudlyCase of its id (stepAccount for id account), or step1, step2, … when it has none. |
| review | bool | true | The final review pane with a per-step edit button; with false the last step carries the submit itself. |
| step | int | 0 | The opening step; for resuming a draft — the steps before it render as completed with their jump-back buttons live. |
| labels / locale | array / string | [] / null | Override the wizard’s own words for one instance (review, submit, progress, of, announce, invalid, edit, editStep, empty, yes, back, next) and the locale of its digits and announcements; the defaults come from the core i18n. |
| wire:submit / action | — | null | The root is a plain <form> and attributes land on it; “next” is refused until the step in view passes the form’s own validation, and the final submit re-enables every pane first so no answer is dropped — wire:model inputs work inside the panes. |
| رویدادها / data-nx-summary | — | — | nx-step-change bubbles on every hop (carrying the step index) and nx-submit just before the form goes out; data-nx-summary on a control names its row in the review (off leaves it out). |
Snippet
<x-nx::wizard heading="ساخت فضای کاری" subtitle="سه گام و آماده"
:steps="[
['id' => 'identity', 'title' => 'هویت', 'description' => 'نام و زمینهٔ کار'],
['id' => 'team', 'title' => 'همکاران', 'description' => 'دعوت و نقشها'],
]"
wire:submit="save('فضای کاری ساخته شد')">
<x-slot:stepIdentity>
<x-nx::input name="wz-name" label="نام فضای کاری" required data-nx-summary="نام فضای کاری" />
</x-slot:stepIdentity>
<x-slot:stepTeam><!-- …فیلدهای گام دوم… --></x-slot:stepTeam>
</x-nx::wizard>