Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Navigation

Stepper

Progress through a multi-step flow (sign-up, checkout).

import { Stepper } from "@stylhero/ui";

Example

Code
import { useState } from "react";
import { Button, Stack, Stepper } from "@stylhero/ui";

function StepperExample() {
  const [active, setActive] = useState(1);
  return (
    <Stack gap={4}>
      <Stepper active={active} onStepClick={setActive} steps={[{ label: "Budget" }, { label: "Parts", description: "Pick or let AI choose" }, { label: "Review" }]} />
      <Stack direction="row" gap={2}>
        <Button variant="secondary" size="sm" disabled={active === 0} onClick={() => setActive(active - 1)}>Back</Button>
        <Button size="sm" disabled={active === 2} onClick={() => setActive(active + 1)}>Next</Button>
      </Stack>
    </Stack>
  );
}

Props

PropTypeDefaultDescription
active required number - Index of the current step, starting at 0. Steps before it show as done.
steps required Step[] -
onStepClick (index: number) => void - Makes each step a button, so people can jump back (MUI's non-linear stepper).
orientation "horizontal" | "vertical" "horizontal"

Also takes every <ol> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.

Types

type Step = { label: ReactNode; description?: ReactNode; /** Shows the step as failed. */ error?: boolean };

Keyboard

KeyDoes
Enter / SpaceWith onStepClick, goes to that step

Accessibility

  • An ordered list; the active step has aria-current="step".

Generated from src/components/Stepper.tsx. Something wrong or missing? Open an issue.