The stepper instance

Understand the object that drives state, navigation, and rendering.

The stepper instance

useStepper() returns a single flat object. Everything you read (current step, index, progress) and everything you do (navigate, save values, complete steps) lives directly on it — no nested state or navigation namespaces.

The fastest way to understand it is to drive one. Click the controls below and watch every value react in real time.

Stepper UI

Account

Step 1 of 4. Collect the sign-in details for this flow.

Current position

You're at the beginning, so Stepperize blocks backward movement.

Account

Progress

0 of 4 completed

0%
x

Understanding this state

First step

Previous navigation is disabled.

Not last

Another step is still ahead.

Back disabled

There is no earlier step to visit.

Can continue

The Next button can move.

Completed steps

0 / 4

No completed steps yet

Recent updates

state changes
  1. Flow ready

    Account is the starting step.

What just happened

  • next() / prev() move the active step. Notice index, progress, and the current.id change together — they are all derived from one source.
  • canPrev / canNext flip automatically at the edges. You never compute "am I on the last step?" yourself — bind buttons straight to them.
  • setComplete() changes completed but leaves the position untouched. Completion is independent from where you are — see Status vs completion.
  • goTo(id) (click any circle) jumps directly to a step by its typed id.

The mental model

Think of the instance as derived state over one pointer. You move the pointer (the current index); everything else — current, progress, isLast, each step's status — is recomputed for you.

const stepper = onboarding.useStepper();

stepper.current; // the active step object (with your custom fields)
stepper.index; // where the pointer is
stepper.next(); // move the pointer forward
stepper.match({ ... }); // render exactly the active step

You only manage intent ("go next", "jump to review"). Stepperize manages the consequences.

The six you need on day one

Most flows ship with just these:

MemberWhat it gives you
currentThe active step object, including your custom fields.
match({...})Exhaustive, type-checked rendering by step id.
next() / prev()Move through the flow.
canNext / canPrevReady-made disabled states for your buttons.

Everything else — values, completion, events, step-map helpers — is there when you need it, and invisible until then. The full instance reference lists every member.

Next: the navigation lifecycle.

Edit on GitHub

Last updated on

On this page