# Introduction

> Typed multi-step flows for React, from one definition.

Source: https://stepperize.com/docs/v9/react

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 typed hook, a provider
and a set of accessible, unstyled components that all share the same step ids.

```tsx
import { defineStepper } from "@stepperize/react";
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" },
]);

function Checkout() {
  const stepper = checkout.useStepper({ onFinish: (output) => placeOrder(output) });

  return (
    <section>
      <h2>{stepper.current.title}</h2>

      {stepper.match({
        shipping: (_step, data) => <ShippingForm defaultValues={data} />,
        payment: (_step, data) => <PaymentForm defaultValues={data} />,
        review: () => <Review data={stepper.data} />,
      })}

      <button type="button" disabled={stepper.isFirst} onClick={() => stepper.prev()}>
        Back
      </button>
      <button type="button" onClick={() => stepper.next(readForm())}>
        {stepper.isLast ? "Place order" : "Continue"}
      </button>
    </section>
  );
}
```

## Is it a form library? [#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. Your form library, or a few
lines of your own, owns the fields. See
[Building multi-step forms](https://stepperize.com/docs/v9/react/forms).

## What you get [#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.
- **Typed everywhere.** Step ids, each step's data and your own fields
  (`title`, `icon`, anything) are inferred from the definition.
- **Branching as data.** A `next` map decides where each step leads from its
  validated data, and a flow can have more than one ending.
- **Resumable.** One `snapshot` goes in, one `onChange` comes out. The current
  step can follow the URL with a single option.
- **Accessible primitives.** Roles, keyboard navigation, focus and
  announcements are handled for you.
- **Small.** About 2.6 kB for the hooks and 5.2 kB with the primitives, min + gzip,
  with no third-party dependencies.

## Next [#next]

- [Installation](https://stepperize.com/docs/v9/react/installation): Add the package to a React 18 or 19 project.

- [Your first stepper](https://stepperize.com/docs/v9/react/first-stepper): A working flow, built in three small steps.

- [Core concepts](https://stepperize.com/docs/v9/react/concepts/steps): Steps, the flow, the lifecycle of a move and step state.

- [Multi-step forms](https://stepperize.com/docs/v9/react/forms): Patterns and complete examples for each form library.

- [Coming from v8](https://stepperize.com/docs/v9/react/migration): What changed, and a codemod that does most of it.

- [Without React](https://stepperize.com/docs/v9/core): The same state machine in tests, servers and agents.
