bearnie

Stepper

A multi-step progress indicator for wizards and forms.

Installation

npx bearnie add stepper
npx bearnie add stepper

Usage

import {
  Stepper,
  StepperItem,
  StepperTrigger,
  StepperTitle,
  StepperDescription,
  StepperSeparator,
} from "@/components/bearnie/stepper"
<Stepper activeStep={0}>
  <StepperItem step={0}>
    <StepperTrigger>1</StepperTrigger>
    <StepperTitle>Step One</StepperTitle>
  </StepperItem>
  <StepperSeparator />
  <StepperItem step={1}>
    <StepperTrigger>2</StepperTrigger>
    <StepperTitle>Step Two</StepperTitle>
  </StepperItem>
</Stepper>

Examples

Simple stepper

Vertical orientation

With icons

Use icons instead of numbers for a more visual representation.

Use the href prop to create steps that link to page sections. A link icon appears on hover.

With custom letters

Use letters or custom text instead of numbers.

Completed steps with checkmark

Show a checkmark icon for completed steps.

Vertical with icons and descriptions

A complete vertical stepper with icons and detailed descriptions.

Linear (gated)

With linear, users can’t jump ahead by clicking steps — only steps they’ve already reached are clickable. Advance with a button carrying data-stepper-next (and go back with data-stepper-prev). Panels with data-stepper-content and a data-step index show the active step’s content.

Fill in your details, then continue.

Props

Stepper

Prop Type Default Description
orientation “horizontal” | “vertical” “horizontal” Layout direction
activeStep number 0 Current active step (0-indexed)
linear boolean false Block clicking steps beyond the furthest step reached
class string - Additional CSS classes

StepperItem

Prop Type Default Description
step number required Step index (0-indexed)
class string - Additional CSS classes

StepperTrigger

Renders as a button by default. When href is provided, renders as an anchor link with a link icon on hover.

Prop Type Default Description
href string - When provided, renders as an anchor link
class string - Additional CSS classes

StepperTitle, StepperDescription

Style components for step labels.

StepperSeparator

Visual connector between steps. Place between StepperItem components. Automatically adapts to orientation.

Events

The stepper dispatches a bubbling stepper-change custom event whenever the active step changes:

document.querySelector("[data-stepper]")?.addEventListener("stepper-change", (e) => {
  console.log((e as CustomEvent).detail.step); // new step index
});