Stepper
Free9 variants — eight wizard styles (default, pill, minimal, icon, dot, line, card, progress-bar) plus a non-interactive tracker — all free, in four sizes (xs–lg) and both orientations. The Pro package adds a timeline with a content panel per step, a circular ring, completed-step summaries, linear wizard mode, guard rules and telemetry.
import { SvStepperComponent } from '@styloviz/stepper';Demo & usage
Basic usage
Usage example — open the gallery for the full interactive demo.
An interactive demo for this component lives in the gallery.
Open live demoMore examples
Any of the 9 variants (free)
<sv-stepper [items]="steps" variant="line" orientation="vertical" [activeIndex]="step" />
Vertical linear wizard (Pro)
<sv-stepper-pro [items]="steps" orientation="vertical" [linear]="true" [interactive]="true" [showDescriptions]="true" [activeIndex]="step" (stepChange)="step = $event" (stepBlocked)="onBlocked($event)" />
Order status tracker (placed → delivered)
variant="tracker" renders a horizontal fulfilment tracker: completed stages fill the rail, the current stage is ringed, each with an icon and timestamp.
<sv-stepper variant="tracker" [items]="orderSteps" [activeIndex]="3" [interactive]="false" />
Cards and a mobile progress bar
variant="card" boxes each step (indicator, title, description) and stacks them on a phone; variant="progress-bar" shows the current step over a segmented bar. size="xs" fits a table cell.
<sv-stepper variant="card" [items]="steps" [(activeIndex)]="step" /> <sv-stepper variant="progress-bar" [items]="steps" [(activeIndex)]="step" progressLabel="Step {current} of {total}" />
Timeline with a panel per step (Pro)
variant="timeline" renders the current step's <ng-template svStepPanel> under it; next() and previous() go through the gates. A complete step's summary replaces its description.
<sv-stepper-pro variant="timeline" [items]="steps" [(activeIndex)]="step"> <ng-template svStepPanel="shipping" let-next="next"> <app-shipping-form (saved)="next()" /> </ng-template> </sv-stepper-pro>
Blocked step → error summary, focus moved
<sv-stepper [items]="steps" [(activeIndex)]="active" [asyncValidation]="true" [announceBlocked]="false" (stepChangeRequest)="validate($event)" (stepBlocked)="errors.set([{ fieldId: 'email', label: 'Work email', message: $event.reason }])" /> <!-- autoFocus moves focus to the summary when it appears; it reads the heading and the reason. --> <sv-form-error-summary [errors]="errors()" heading="This step needs attention" />
When to use
Job: workflow state — renders step buttons and emits step events; it never navigates the page (compare all seven in the “Choosing a navigation pattern” guide under Guides). Guiding users through a sequential, multi-step process (checkout, onboarding, wizards). You want progress indication, and — on the Pro package — per-step validation gating. For non-sequential views, use Tabs; for an overlay walkthrough, a Product Tour.
Async states
- loading
- error
- retry
Saved state
- Stored kinds
- sv-stepper/resume
What you will find under your own storage key. You choose the key; the blob names its own
kindand schemaversion, so a component never reads state another one wrote.- Reading it back
- Restore through the component's own
restore…helper rather than casting the parsed JSON. A blob from an older release is migrated where it can be and refused with a reason where it cannot — so an upgrade never silently applies last month's shape to this month's fields.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| items | StepperItem[] | [] | The steps to render (label, optional description, state). |
| activeIndex | number (two-way) | 0 | 0-based active step index. Supports two-way binding via `[(activeIndex)]`. |
| orientation | StepperOrientation | 'horizontal' | Layout: horizontal or vertical. |
| variant | StepperVariant | 'default' | Visual variant — and with it, whether this is a wizard or a tracker. `default`, `pill`, `minimal`, `icon`, `dot` and `line` are WIZARD styles: every step is a `<button>`, and the linear gate, keyboard, `stepClick` and the unsaved prompt are all live. `'tracker'` is a PROGRESS DISPLAY (an order-status strip): it renders a non-interactive `<ol>` with no buttons, so nothing in it can be clicked, focused or arrowed through and `stepClick` / `stepChangeRequest` never fire from it. `'card'` boxes each step (indicator, title, description) and stacks them on a phone; `'progress-bar'` is a segmented bar under the current step's label, for a narrow screen — both are wizard styles. Two axes share this one input — look and interactivity. Choose `tracker` to show where something IS, not to let the user move it; for a wizard's look without its navigation, keep a wizard style and set `interactive=false` instead. |
| size | StepperSize | 'md' | Step size: xs (a table row or a toolbar), sm, md or lg. |
| progressLabel | string | 'Step {current} of {total}' | The position text the `progress-bar` variant shows — `{current}` and `{total}` are filled in. Translate it here. |
| mode | StepperMode | 'standard' | Navigation mode: standard sequence, or branch (conditional paths via `activeBranch`). |
| interactive | boolean | true | Whether users can click steps to navigate. |
| showDescriptions | boolean | true | Show step descriptions under labels. |
| showConnectors | boolean | true | Render connectors between steps. |
| enableHotkeys | boolean | false | Enables advanced keyboard shortcuts for rapid step navigation. |
| announceBlocked | boolean | true | Announce a refused move (and why) to screen readers through the shared live region. Turn it off when the host already moves focus to its own message on `(stepBlocked)`. |
| activeBranch | string | null (two-way) | null | Active branch key used in `mode='branch'`. Supports two-way binding. |
| customClass | string | '' | Extra CSS classes for the root element. |
| urlKey | string | null | null | Put the current step's **id** in the URL under this key, so a step can be shared and the back button moves one step back. Needs `provideSvNavLocation()` at the app root. |
| surfaceId | string | null | null | Names this stepper in the shared navigation-analytics stream, when a page has more than one. Ignored unless `provideSvNavTelemetry()` is wired up. |
| persistKey | string | '' | Where `localStorage` keeps this workflow's position, so a reload resumes rather than restarting. Stores the step id and branch only — never the host's form data. Empty = no persistence. |
| asyncValidation | boolean | false | Ask before moving. With this on, activating a step emits `stepChangeRequest` and nothing happens until the host calls `allow()` or `deny()` — which is what lets a wizard validate the current step against the server before letting the user leave it. |
| validatingIndex | number | -1 | Index currently being validated, or `-1`. That step shows a spinner and the stepper ignores further activations, so a double-click cannot start two validations. |
| revisitPolicy | StepperRevisitPolicy | 'preserve' | What returning to an earlier step does to the steps after it. See StepperRevisitPolicy. The default, `'preserve'`, invalidates nothing, so a wizard only loses completed steps when it asks for that. |
| invalidatesOnRevisit | ((context: StepperRevisitContext) => readonly string[]) | null | null | With `revisitPolicy="custom"`, the step ids a revisit invalidates. Ids that are not visible steps are ignored. ```ts protected readonly recomputeTotals = (c: StepperRevisitContext) => c.step.id === 'billing' ? ['shipping', 'confirm']: []; ``` |
| dirty | boolean | false | Is there unsaved work in the step the user is on? Set this and a click on another step asks before leaving, instead of abandoning the step's form with no warning and no undo. The prompt comes from `createCloseGuard`, the same primitive Modal, Drawer and Confirm Dialog use, so it behaves identically in all four. |
| canLeaveStep | ((reason: StepperLeaveReason) => boolean | void) | null | null | The host's own veto on leaving a step, consulted **before** the unsaved check. Return `false` to refuse; return nothing to have no opinion. A veto is silent — it does NOT raise the unsaved-changes prompt, because the host refused for its own reasons and owns its own messaging. That ordering is the primitive's, not this component's. |
| showUnsavedPrompt | boolean | true | Render the built-in unsaved-changes prompt. Turn it off to drive your own dialog from `promptingDiscard()` / `discardChanges()` / `keepEditing()`. |
| unsavedTitle | string | 'Leave this step?' | Heading of the unsaved-changes prompt. |
| unsavedMessage | string | 'This step has changes that have not been saved.' | Body of the unsaved-changes prompt. |
| discardLabel | string | 'Discard' | Label of the button that leaves and loses the changes. |
| keepEditingLabel | string | 'Keep editing' | Label of the button that stays on the step. |
| loading | boolean | false | True while the step definition is being fetched. A wizard defined server-side — onboarding flows, dynamic forms — arrives asynchronously. |
| error | SvDataError | string | null | null | Failure loading the step definition. Rendered in place of the content, with a retry. |
Outputs
| Event | Payload type | Description |
|---|---|---|
| retry | void | The host should re-run the failed load. |
| stepChange | StepperChangeEvent | Emitted when the active step changes. |
| unresolved | SvUnresolvedValue<number> | Emitted when `activeIndex` names a step that does not exist. Carries what was asked for, what is shown, and whether `activeIndex` was corrected. |
| stepClick | { index: number; step: StepperItem } | Emitted when a step is clicked. |
| stepBlocked | StepperBlockedEvent | Emitted when navigation to a step is blocked (e.g. linear validation). |
| stepChangeRequest | StepperChangeRequest | A move the host must approve. Only emitted when `asyncValidation` is on. See StepperChangeRequest. |
| branchChange | StepperBranchChangeEvent | Emitted when the active branch changes (branch mode). |
| stepTransition | { readonly step: StepperItem; readonly index: number; readonly transition: StepperTransition; readonly from: StepperStepLifecycle; readonly to: StepperStepLifecycle; } | A named lifecycle transition just happened. The transition, not just the destination. `enter` and `reopen` both land in `active`, and a host that invalidates later work needs to know which of the two it was; `stepChange` cannot tell it. |
| stepsInvalidated | StepperInvalidationEvent | The revisit policy has marked these steps not done. See StepperInvalidationEvent. |
| flowStatusChange | StepperFlowStatus | `complete` and `valid`, reported separately — see StepperFlowStatus. |
| discarded | StepperLeaveReason | The user chose to abandon unsaved work; the move follows. |
| leaveCancelled | StepperLeaveReason | The user chose to stay on the step. Nothing moved. |
| activeIndexChange | number | Emits the new `activeIndex` whenever it changes — the output half of `[(activeIndex)]`. |
| activeBranchChange | string | null | Emits the new `activeBranch` whenever it changes — the output half of `[(activeBranch)]`. |
<sv-stepper-pro>
Also in this family — SvStepperProComponent from @styloviz-pro/stepper.
Async states
- loading
- error
- retry
Saved state
- Stored kinds
- sv-stepper-pro/resume
What you will find under your own storage key. You choose the key; the blob names its own
kindand schemaversion, so a component never reads state another one wrote.- Reading it back
- Restore through the component's own
restore…helper rather than casting the parsed JSON. A blob from an older release is migrated where it can be and refused with a reason where it cannot — so an upgrade never silently applies last month's shape to this month's fields.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| items | StepperItem[] | [] | The steps, in order. In `mode="branch"` a step with a `branch` key is shown only while that branch is active. |
| activeIndex | number (two-way) | 0 | 0-based active step index. Supports two-way binding via `[(activeIndex)]`. |
| orientation | StepperOrientation | 'horizontal' | Lay the steps out in a row (`horizontal`) or a column (`vertical`). |
| variant | StepperVariant | 'default' | Visual variant — and with it, whether this is a wizard or a tracker. `default`, `pill`, `minimal`, `icon`, `dot` and `line` are WIZARD styles: every step is a `<button>`, and the linear gate, keyboard, `stepClick` and the unsaved prompt are all live. `'tracker'` is a PROGRESS DISPLAY (an order-status strip): it renders a non-interactive `<ol>` with no buttons, so nothing in it can be clicked, focused or arrowed through and `stepClick` / `stepChangeRequest` never fire from it. `'card'` boxes each step (indicator, title, description) and stacks them on a phone; `'progress-bar'` is a segmented bar under the current step's label, for a narrow screen — both are wizard styles. Pro adds `'timeline'` (vertical, with a content panel under the current step — see `SvStepPanelDirective`) and `'circular'` (a ring showing n of total, for a compact header). Two axes share this one input — look and interactivity. Choose `tracker` to show where something IS, not to let the user move it; for a wizard's look without its navigation, keep a wizard style and set `interactive=false` instead. |
| size | StepperSize | 'md' | Step size: xs (a table row or a toolbar), sm, md or lg. |
| progressLabel | string | 'Step {current} of {total}' | The position text the `progress-bar` variant and `circular` shows — `{current}` and `{total}` are filled in. Translate it here. |
| summaryEditLabel | string | 'Edit' | The word on a complete step's summary that says it can be changed. |
| nextStepLabel | string | 'Next' | Lead-in for the step after the current one in `variant="circular"`. |
| mode | StepperMode | 'standard' | `branch` enables conditional workflows: steps are filtered by `activeBranch`, and a step's `selectsBranch` switches it. |
| linear | boolean | false | If true, blocked future steps cannot be selected unless prior steps are complete. |
| interactive | boolean | true | Whether users can click steps to navigate. |
| showDescriptions | boolean | true | Show step descriptions under labels. |
| showConnectors | boolean | true | Render connectors between steps. |
| enableHotkeys | boolean | false | Enables advanced keyboard shortcuts for rapid step navigation. |
| announceBlocked | boolean | true | Announce a refused move (and why) to screen readers through the shared live region. Turn it off when the host already moves focus to its own message on `(stepBlocked)`. |
| guardRules | Record<string, string[]> | {} | Optional guard map where each key is a target step id and the value lists step ids that must be complete before selecting that target. |
| activeBranch | string | null (two-way) | null | Active branch key used in `mode='branch'`. Supports two-way binding. |
| customClass | string | '' | Extra CSS classes added to the root element. |
| urlKey | string | null | null | Put the current step's **id** in the URL under this key, so a step can be shared and the back button moves one step back. Needs `provideSvNavLocation()` at the app root. |
| surfaceId | string | null | null | Names this stepper in the shared navigation-analytics stream, when a page has more than one. Ignored unless `provideSvNavTelemetry()` is wired up. |
| persistKey | string | '' | Where `localStorage` keeps this workflow's position, so a reload resumes rather than restarting. Stores the step id and branch only — never the host's form data. Empty = no persistence. |
| asyncValidation | boolean | false | Ask before moving. With this on, activating a step emits `stepChangeRequest` and nothing happens until the host calls `allow()` or `deny()` — which is what lets a wizard validate the current step against the server before letting the user leave it. |
| validatingIndex | number | -1 | Index currently being validated, or `-1`. That step shows a spinner and the stepper ignores further activations, so a double-click cannot start two validations. |
| revisitPolicy | StepperRevisitPolicy | 'preserve' | What returning to an earlier step does to the steps after it. See StepperRevisitPolicy. The default, `'preserve'`, invalidates nothing, so a wizard only loses completed steps when it asks for that. |
| invalidatesOnRevisit | ((context: StepperRevisitContext) => readonly string[]) | null | null | With `revisitPolicy="custom"`, the step ids a revisit invalidates. Ids that are not visible steps are ignored. ```ts protected readonly recomputeTotals = (c: StepperRevisitContext) => c.step.id === 'billing' ? ['shipping', 'confirm']: []; ``` |
| dirty | boolean | false | Is there unsaved work in the step the user is on? Set this and a click on another step asks before leaving, instead of abandoning the step's form with no warning and no undo. The prompt comes from `createCloseGuard`, the same primitive Modal, Drawer and Confirm Dialog use, so it behaves identically in all four. |
| canLeaveStep | ((reason: StepperLeaveReason) => boolean | void) | null | null | The host's own veto on leaving a step, consulted **before** the unsaved check. Return `false` to refuse; return nothing to have no opinion. A veto is silent — it does NOT raise the unsaved-changes prompt, because the host refused for its own reasons and owns its own messaging. That ordering is the primitive's, not this component's. |
| showUnsavedPrompt | boolean | true | Render the built-in unsaved-changes prompt. Turn it off to drive your own dialog from `promptingDiscard()` / `discardChanges()` / `keepEditing()`. |
| unsavedTitle | string | 'Leave this step?' | Heading of the unsaved-changes prompt. |
| unsavedMessage | string | 'This step has changes that have not been saved.' | Body of the unsaved-changes prompt. |
| discardLabel | string | 'Discard' | Label of the button that leaves and loses the changes. |
| keepEditingLabel | string | 'Keep editing' | Label of the button that stays on the step. |
| loading | boolean | false | True while the step definition is being fetched. A wizard defined server-side — onboarding flows, dynamic forms — arrives asynchronously. |
| error | SvDataError | string | null | null | Failure loading the step definition. Rendered in place of the content, with a retry. |
Outputs
| Event | Payload type | Description |
|---|---|---|
| retry | void | The host should re-run the failed load. |
| stepChange | StepperChangeEvent | The active step changed (click, keyboard, URL or an approved `stepChangeRequest`). Carries the previous and new index and the new step. |
| unresolved | SvUnresolvedValue<number> | Emitted when `activeIndex` names a step that does not exist. Carries what was asked for, what is shown, and whether `activeIndex` was corrected. |
| stepClick | { index: number; step: StepperItem } | A step was pressed, before any gate or validation runs; fires even if the move is then blocked. Carries its index and item. |
| stepBlocked | StepperBlockedEvent | A move was refused by a disabled step, the `linear` gate, `guardRules`, or an async `deny()`. Carries the target step and the reason. |
| stepChangeRequest | StepperChangeRequest | A move the host must approve. Only emitted when `asyncValidation` is on. See StepperChangeRequest. |
| branchChange | StepperBranchChangeEvent | Activating a step with `selectsBranch` switched the active branch. Carries the new branch and the step that selected it. |
| telemetry | StepperTelemetryEvent | Analytics stream for the whole flow — emits `guard_hit`, `blocked` and `branch_switch` events with the step id, index, active branch and block reason. |
| stepTransition | { readonly step: StepperItem; readonly index: number; readonly transition: StepperTransition; readonly from: StepperStepLifecycle; readonly to: StepperStepLifecycle; } | A named lifecycle transition just happened. The transition, not just the destination. `enter` and `reopen` both land in `active`, and a host that invalidates later work needs to know which of the two it was; `stepChange` cannot tell it. |
| stepsInvalidated | StepperInvalidationEvent | The revisit policy has marked these steps not done. See StepperInvalidationEvent. |
| flowStatusChange | StepperFlowStatus | `complete` and `valid`, reported separately — see StepperFlowStatus. |
| discarded | StepperLeaveReason | The user chose to abandon unsaved work; the move follows. |
| leaveCancelled | StepperLeaveReason | The user chose to stay on the step. Nothing moved. |
| activeIndexChange | number | Emits the new `activeIndex` whenever it changes — the output half of `[(activeIndex)]`. |
| activeBranchChange | string | null | Emits the new `activeBranch` whenever it changes — the output half of `[(activeBranch)]`. |
Wire it to your API
This component is headless about transport: it renders what you give it and reports what the user asks for. Nothing below requires @styloviz/data — drive it from whatever you already use.
Template
Bound to the names this component actually exposes.
<sv-stepper [items]="items()" [loading]="loading()" [error]="error()" (retry)="load()" />
Host class
Drive the three async inputs from your own fetch.
import { signal } from '@angular/core'; import { toSvDataError, type SvDataError } from '@styloviz/core'; import type { StepperItem } from '@styloviz/stepper'; readonly items = signal<StepperItem[]>([]); readonly loading = signal(false); readonly error = signal<SvDataError | null>(null); async load(): Promise<void> { this.loading.set(true); this.error.set(null); try { const res = await fetch('/api/items'); if (!res.ok) throw res; this.items.set(await res.json()); } catch (e) { this.error.set(toSvDataError(e)); } finally { this.loading.set(false); } }
This component does not emit a query, so it renders what you give it. Call `load()` on your own trigger and bind `items`, `loading` and `error`. Normalize failures with `toSvDataError()` from `@styloviz/core`. It derives `retryable` from the status, so a 404 does not get a "Try again" button that can only fail again.
Full walkthrough: Connecting to a backend.
Customization & theming
Nine variants — default, pill, minimal, icon, dot, line, card, progress-bar and the non-interactive tracker — all included in the free package. Four sizes (xs · sm · md · lg) and horizontal or vertical orientation; `progressLabel` words the progress bar's "Step {current} of {total}". Pro adds: the `timeline` variant with an `<ng-template svStepPanel>` per step, the `circular` ring, completed-step `summary` lines with an Edit affordance, linear wizard mode with per-step validation, guard rules and branch telemetry.
Best practices
Do: Use `[linear]="true"` (Pro) when later steps depend on earlier ones being valid. Do: Clearly mark completed, current and blocked steps. Tip: Switch to vertical orientation when step descriptions are long.
Accessibility
Rendered as a labelled `list` of `listitem`s; each step is a real `<button>` (announced as a button) that exposes completed/current/disabled state via `aria-current="step"` and `aria-disabled`. Keyboard reachable either way: by default every step a click would open is a Tab stop and Enter or Space opens it; with `enableHotkeys` the current step is the one tab stop, Arrow/Home/End move to and open a step, and the number keys jump to one. A refused move is spoken: `stepBlocked` also announces "Cannot go to {step}. {reason}" through the shared live region — the built-in reason (disabled, not validated; Pro: linear, guard) or the host's own `deny('…')` text. Set `[announceBlocked]="false"` when your `(stepBlocked)` handler moves focus to an `sv-form-error-summary`, which speaks for itself. With `enableHotkeys`, a horizontal stepper's ArrowLeft / ArrowRight mirror under `dir="rtl"` (read from the host), so the arrow always points at the step it moves to.
Feedback on Stepper
Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.