Skip to Content

Stepper

Progress through numbered steps, with arrow-key navigation.

Cart
3 items
Shipping
Address
Payment
Card details
Review
import { Stepper } from "@dapplelight/signet-ui/components/stepper"
const steps = [
  { title: "Cart", description: "3 items" },
  { title: "Shipping", description: "Address" },
  { title: "Payment", description: "Card details" },
  { title: "Review" },
]

export function Demo() {
  return (
    <Stepper aria-label="Checkout" steps={steps} current={1} />
  )
}

Installation

npm i @dapplelight/signet-ui

Usage

import { Stepper } from "@dapplelight/signet-ui/components/stepper"

<Stepper aria-label="Checkout" steps={[{ title: "Cart" }, { title: "Payment" }]} current={0} />

Examples

Vertical

Cart
3 items
Shipping
Address
Payment
Card details
Review
import { Stepper } from "@dapplelight/signet-ui/components/stepper"
const steps = [
  { title: "Cart", description: "3 items" },
  { title: "Shipping", description: "Address" },
  { title: "Payment", description: "Card details" },
  { title: "Review" },
]

export function Demo() {
  return (
    <Stepper aria-label="Checkout" steps={steps} current={2} orientation="vertical" className="max-w-xs" />
  )
}

Controlled

Cart
3 items
Shipping
Address
Payment
Card details
Review
import { useState } from "react"
import { Stepper } from "@dapplelight/signet-ui/components/stepper"
import { Button } from "@dapplelight/signet-ui/components/button"
const steps = [
  { title: "Cart", description: "3 items" },
  { title: "Shipping", description: "Address" },
  { title: "Payment", description: "Card details" },
  { title: "Review" },
]

export function Demo() {
  const [current, setCurrent] = useState(0)
  return (
    <div className="w-full space-y-6">
      <Stepper aria-label="Checkout" steps={steps} current={current} />
      <div className="flex gap-2">
        <Button variant="outline" disabled={current === 0} onClick={() => setCurrent(current - 1)}>
          Back
        </Button>
        <Button disabled={current === steps.length} onClick={() => setCurrent(current + 1)}>
          {current === steps.length - 1 ? "Place order" : "Next"}
        </Button>
      </div>
    </div>
  )
}

Custom indicator

Cart
3 items
Shipping
Address
Payment
Card details
Review
import { Stepper } from "@dapplelight/signet-ui/components/stepper"
const steps = [
  { title: "Cart", description: "3 items" },
  { title: "Shipping", description: "Address" },
  { title: "Payment", description: "Card details" },
  { title: "Review" },
]

export function Demo() {
  return (
    <Stepper
      aria-label="Checkout"
      steps={steps}
      current={1}
      renderIndicator={(i, status) => (status === "complete" ? "✓" : String.fromCharCode(65 + i))}
    />
  )
}

API Reference

PropTypeDefaultDescription
stepsStepperStep[]-Each step has a title and an optional description, both ReactNode.
currentnumber-Index of the current step, from 0. Earlier steps are complete; past the end, all are.
aria-labelstring-Required. Names the steps for screen readers.
orientation"horizontal" | "vertical""horizontal"Layout direction.
renderIndicator(index: number, status: StepStatus) => ReactNode-Replaces the number or check. status is complete, current or upcoming.
classNamesPartial<Record<"item" | "indicator" | "connector" | "title" | "description", string>>{}Classes for each part of every step.
classNamestring-Merged onto the root.

Plus every native <div> prop except children.