Introduction
Typed multi-step flows for Angular, with signals, from one definition.
Stepperize is for flows where someone moves through named steps: checkout, onboarding, surveys, import wizards, approval flows and multi-step forms.
You describe the steps once. The definition gives you a signals API for your components and services, and a set of accessible, unstyled directives for your own templates.
import { Component } from "@angular/core";
import { defineStepper } from "@stepperize/angular";
import { z } from "zod";
const checkout = defineStepper([
{ id: "shipping", title: "Shipping", schema: z.object({ address: z.string().min(1) }) },
{ id: "payment", title: "Payment", schema: z.object({ card: z.string().length(16) }) },
{ id: "review", title: "Review" },
]);
@Component({
selector: "app-checkout",
template: `
<h2>{{ stepper().current.title }}</h2>
@switch (stepper().current.id) {
@case ("shipping") { <app-shipping-form /> }
@case ("payment") { <app-payment-form /> }
@case ("review") { <app-review [data]="stepper().data" /> }
}
<button type="button" [disabled]="stepper().isFirst" (click)="stepper().prev()">Back</button>
<button type="button" (click)="stepper().next(readForm())">
{{ stepper().isLast ? "Place order" : "Continue" }}
</button>
`,
})
export class Checkout {
readonly stepper = checkout.injectStepper({ onFinish: (output) => placeOrder(output) });
}A flow built with the primitives, running:
Loading angular…
Is it a form library?
No. Stepperize owns the flow: which step is current, moving between steps, what each step saved and which steps are complete. Angular's forms own the fields. See Forms.
What you get
- One call moves forward.
next(data)saves the step's data, validates it against the step's schema and moves on. It resolves with what happened instead of throwing. - Signals. The stepper is a signal: templates,
computedandeffectfollow it, with no subscription to manage. - Typed. Step ids, each step's data and your own fields (
title,icon, anything) are inferred from the definition, in TypeScript and in template expressions. Register a definition and the step ids you give the directives are checked too. - Branching as data. A
nextmap decides where each step leads from its validated data, and a flow can have more than one ending. - Resumable. One
snapshotgoes in, oneonChangecomes out. The current step can follow the router with a single option. - Accessible primitives. Standalone directives handle roles, keyboard navigation, focus and announcements.
- Zoneless and server rendered. No zone.js needed; the server HTML already has the roles, and hydration adopts it.
- Small. About 3.2 KiB for the signals API and 8.7 KiB with the primitives, min + gzip, with no runtime dependencies besides the core.
The same flow as every other binding
The state machine is @stepperize/core, shared by every
binding, so the concepts are the same everywhere. Each has its own page,
with Angular code: steps,
the lifecycle of a move,
step state,
validation,
branching and
persistence.
Next
Last updated on