Skip to content

React Stepper

An animated React stepper for multi-step forms and checkouts that collapses to “Step 2 of 4” on phones.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/stepper.json

Next: Account

Checkout

Click a completed step to go back to it. Toggle the error to see a step flag itself; screen readers hear each step's state.

Files to copy

5 folders · 3 files · 4 packages
From theme/src/
  • components/stepper/
  • components/status-icons/
  • hooks/use-latest.ts
  • lib/{cn.ts, form.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/stepper.jsonRegistry item: stepper. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/button/
  • components/spinner/
  • components/switch/
  • hooks/{use-direction.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{field-control-shell.tsx, motion-props.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/switch.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Vertical, with content

The current step reveals its own content. Optional steps say so.

Labels beside, compact, translated

labelPlacement="end" puts titles next to the dots. The compact view is what phones get automatically. Every string, punctuation included, comes from labels.

Stepper

PropTypeDefaultDescription
steps (required)StepperStep[]NoneThe steps to show, in order.
current (required)numberNoneIndex of the current step (0-based). steps.length = all complete.
orientation"horizontal" | "vertical""horizontal"Direction the steps are laid out in.
labelPlacement"end" | "bottom""bottom"Horizontal only: labels under the dots ("bottom", default) or beside them ("end").
onStepClick((index: number) => void)NoneMakes steps clickable buttons.
clickable"all" | "completed""completed"Which steps onStepClick applies to: "completed" (default) or "all".
collapse"auto" | "never" | "always""auto"Horizontal only: "auto" (default) collapses to "Step x of y" when there is not enough room.
minStepWidthnumber136Room (px) each step needs before "auto" collapses.
size"sm" | "md""md"Sets the dot and text size.
labelsPartial<StepperLabels>defaultStepperLabelsOverride the strings (i18n). Give each stepper on a page its own nav. Every other string, for translation: labels={{ nav: "…" }}; omitted keys keep the English of defaultStepperLabels. All 10 keys of StepperLabels are listed in the key table under the props table.
classNamestringNoneExtra classes for the <nav> that wraps the steps (set its width or spacing here).
StepperLabels keys and English defaults (10)
Pass any key in labels; the rest keep the defaults of defaultStepperLabels.
KeyEnglish default
navProgress
stepOf(step, total) => `Step ${step} of ${total}`
completecompleted
currentcurrent step
upcomingnot started
errorneeds attention
status(words) => `, ${words.join(", ")}`
optionalOptional
next(title) => ( <> Next: <strong>{title}</strong> </> )
doneAll steps complete

Keyboard

KeysAction
Tab/Shift + TabClickable steps are normal tab stops; non-clickable steps are not focusable.
Enter/SpaceGo to the focused step.

Accessibility

  • An ordered list (<ol>) in a <nav>; the current step has aria-current="step" and every state (complete, current, upcoming, error) is also spoken.
  • When current changes, keyboard focus stays in the stepper (it moves to the next step if its button disappeared).
  • The compact "Step 2 of 4" view keeps the same information; every string is translatable through labels.

All exports on this page

  • Stepper — Stepper: progress through a multi-step flow (checkout, onboarding, setup wizards).
  • defaultStepperLabels — Default English strings of StepperLabels; spread it and override single keys to reword.

When to use Stepper

  • Use it as the progress steps of a multi-step form, such as a checkout with Cart, Shipping, Payment and Review, where completed steps can be revisited and a failed payment step can flag itself with an error state.
  • Use orientation="vertical" with per-step content for an onboarding or setup wizard, where the current step reveals its own form and optional steps are labeled as such.
  • Use it for a long application form on phones, where the automatic compact view shows Step 2 of 4 with a segmented bar instead of cramped titles.
  • Skip it when the user can move between views freely with no order; Tabs is the right pattern for parallel views, and Breadcrumb shows where a page sits in the site hierarchy.
  • Pair it with Button for Back and Next, Field and Input for each step's form, and Progress when you also want a continuous completion value.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .