Skip to content

Stepper

A progress indicator that walks the user through a sequence of ordered steps with pending, active, complete, and error states.

  • stable
  • since v0.1.0
  • 3.5 kB
  • navigation
  • stepper
  • accessible

Renders an ordered list; the active step receives aria-current="step"; interactive mode exposes each step as a labelled button.

Preview
Open
tsx
import { Stepper, Step } from "@arshad-shah/cynosure-react";
<Stepper currentStep={1}>
<Step title="Account" />
<Step title="Profile" />
<Step title="Confirm" />
</Stepper>

currentStep is zero-indexed. Steps before currentStep derive status="complete", the matching step is "active", and any later steps are "pending". Pass status explicitly to override the default for a specific step (handy for "error").

Use orientation="vertical" for sidebar-style flows.

Preview
Open
tsx

Switch the marker style with variant="numbered" (default), "dots", "lines", or "icons". The icons variant accepts a custom icon on each Step.

Preview
Open
tsx

Use size="sm", "md" (default), or "lg" to scale the marker and typography.

Preview
Open
tsx

Pass description to render a muted second line under the title.

Preview
Open
tsx

Pass interactive together with onStepChange to let users click completed or active steps to jump back. Pending steps remain unreachable.

Preview
Open
tsx

Force a step’s status with the status prop — typically "error" for validation failures.

Preview
Open
tsx
PropTypeDefaultDescription
currentStep*
number
Zero-indexed currently-active step. Steps with `index < currentStep` default to `complete`; the matching index defaults to `active`; the rest default to `pending`.
variant
"numbered"|"dots"|"lines"|"icons"
numbered
Visual treatment for the step marker. `numbered` shows 1-based numbers; `dots` collapses to small filled dots; `lines` shrinks to thin segments; `icons` defers to consumer `icon` props.
size
"sm"|"md"|"lg"
md
Size of markers and labels.
orientation
"horizontal"|"vertical"
horizontal
Layout direction. `horizontal` lines steps across the row; `vertical` stacks them with connectors running top-to-bottom.
interactive
boolean
false
Allow clicking completed / active steps to jump back. Renders each step as a `<button>` and forwards clicks to `onStepChange`.
onStepChange
((step: number) => void)
Fired with the clicked step's index when `interactive` is enabled.
  • The root renders as <ol> so the order of steps is exposed to assistive tech.
  • The active step’s <li> carries aria-current="step".
  • Each step also gets a data-status="pending|active|complete|error" attribute so consumers can target individual states with CSS.
  • In interactive mode each reachable step renders a real <button> with an aria-label derived from its title (or "Step N" if the title is non-string).
  • Connector lines are aria-hidden="true" — purely decorative.
  • Use variant="dots" for compact progress meters where titles aren’t useful.
  • Pair with a form’s isValid flag to advance currentStep only when the current step’s fields pass validation.
  • Provide a custom icon on each Step plus variant="icons" for onboarding flows where the steps represent distinct activities.
  • Combine interactive with controlled currentStep to let users freely navigate between visited steps.