vaiperui

components / stepper

Stepper

Shows progress through a sequential flow such as a checkout or onboarding.

How to use

Put `Step`s inside a `Stepper` and set `current` (zero-based): earlier steps are completed (check), the current one is highlighted with `aria-current="step"`, later ones are upcoming. It only displays progress; your screen handles moving and validating. Pass `onStepClick` to turn completed steps into buttons that go back. Use `orientation="vertical"` with a `description` on each step.

preview
  1. Address
  2. Payment
Stepper.tsx
import { Step, Stepper } from "vaiperui";
<Stepper current={1} aria-label="Signup steps">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>

Colors

preview
  1. AccountCompleted
  2. Address
  3. Payment
primary
  1. AccountCompleted
  2. Address
  3. Payment
success
  1. AccountCompleted
  2. Address
  3. Payment
warning
  1. AccountCompleted
  2. Address
  3. Payment
danger
colors.tsx
<Stepper current={1} variantColor="primary">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>
<Stepper current={1} variantColor="success">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>
<Stepper current={1} variantColor="warning">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>
<Stepper current={1} variantColor="danger">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>

Sizes

preview
  1. AccountCompleted
  2. Address
  3. Payment
sm
  1. AccountCompleted
  2. Address
  3. Payment
md
  1. AccountCompleted
  2. Address
  3. Payment
lg
sizes.tsx
<Stepper current={1} size="sm">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>
<Stepper current={1} size="md">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>
<Stepper current={1} size="lg">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>

Custom color

preview
  1. AccountCompleted
  2. Address
  3. Payment
Orange
  1. AccountCompleted
  2. Address
  3. Payment
Violet
custom-color.tsx
<Stepper current={1} customColor="#f97316">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>
<Stepper current={1} customColor="#8b5cf6">
<Step>Account</Step>
<Step>Address</Step>
<Step>Payment</Step>
</Stepper>

Vertical

preview
  1. AccountEmail and passwordCompleted
  2. AddressWhere to ship
  3. PaymentCard or slip
vertical
vertical.tsx
<Stepper current={1} orientation="vertical">
<Step description="…">Account</Step>
…
</Stepper>

Props

PropValuesDefaultDescription
currentnumberrequiredZero-based index of the active step
orientationhorizontal | verticalhorizontalLayout of the steps
onStepClick(index: number) => voidnoneMakes completed steps buttons that call this with their index
completedLabelstringCompletedScreen-reader text added to completed steps
variantColorprimary | success | warning | dangerprimaryAccent color of the active state and focus ring
customColorstring | { light, dark }noneAny CSS color (or a pair per theme). Overrides variantColor
sizesm | md | lgmdSize of the control and its text
animationnone | smooth | fast | bouncesmoothTransition between states
Step: children, descriptionReactNode, ReactNodenoneThe step's label and an optional secondary line

Accessibility

  • Renders an ordered list (`<ol>`) with one `<li>` per step, in reading order.
  • The current step's `<li>` has `aria-current="step"`.
  • Completed steps include visually hidden text from `completedLabel` (default "Completed").
  • The number, check icon and connector lines are `aria-hidden`.
  • With `onStepClick`, only completed steps become native buttons; current and upcoming steps are plain text.

Keyboard

KeyAction
TabMoves through completed steps when `onStepClick` is set.
Enter / SpaceActivates the focused completed step.

Keep in mind

  • Translate `completedLabel`; its default is in English.
  • It is a progress indicator, not a navigation widget: it adds no `aria-label` to the list and does not let users jump to future steps.