Installation
npx logic2b@next add stepperUsage
import {
Stepper,
StepperIndicator,
StepperItem,
StepperSeparator,
StepperTitle,
StepperTrigger,
} from "@/components/ui/stepper"
<Stepper defaultValue={1}>
<StepperItem step={1}>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Account</StepperTitle>
</StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem step={2}>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Confirm</StepperTitle>
</StepperTrigger>
</StepperItem>
</Stepper>
Each step derives its state from the root value: steps below it are
completed (the indicator swaps to a check), the matching step is active
(and carries aria-current="step"), the rest are upcoming.
Examples
Vertical
Set orientation="vertical" for tall flows — separators become connector
lines between the indicators, with room for descriptions.
Accessibility
- Rendered as an ordered list (
<ol>/<li>), so the step count and order are announced natively. - The active step exposes
aria-current="step". - Triggers are real buttons: focusable, disabled when the item is
disabled, and the completed/active/upcoming state rides ondata-statefor styling only. - Separators are
aria-hidden— purely decorative.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Stepper
defaultValue={2}
orientation="horizontal"
aria-label="Release progress"
>
<StepperItem
step={1}
>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Plan</StepperTitle>
</StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem
step={2}
>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Build</StepperTitle>
</StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem
step={3}
>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Release</StepperTitle>
</StepperTrigger>
</StepperItem>
</Stepper>API reference
Generated from the public TypeScript exports in src/ui/stepper.tsx.
Stepper
ComponentProps: Omit<React.ComponentProps<"ol">, "defaultValue"> & { value?: number defaultValue?: number onValueChange?: (step: number) => void orientation?: "horizontal" | "vertical" }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
value | number | No | — | — |
defaultValue | number | No | — | — |
onValueChange | (step: number) => void | No | — | — |
orientation | "horizontal" | "vertical" | No | "horizontal" | — |
StepperItem
ComponentProps: React.ComponentProps<"li"> & { step: number disabled?: boolean }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
step | number | Yes | — | — |
disabled | boolean | No | false | — |
StepperTrigger
ComponentProps: React.ComponentProps<"button">StepperIndicator
ComponentProps: React.ComponentProps<"span">StepperTitle
ComponentProps: React.ComponentProps<"span">StepperDescription
ComponentProps: React.ComponentProps<"span">StepperSeparator
ComponentProps: React.ComponentProps<"div">Accessibility contract
Machine-readable behavior and consumer responsibilities for stepper.
- Support
- Authored behavior
- Pattern
- step list
- HTML ordered list + buttons
| Keys | Behavior |
|---|---|
| Enter Space | Activate the focused control. |
Built-in semantics
- The active item exposes aria-current=step; separators are aria-hidden.
Consumer responsibilities
- Give every trigger descriptive text and do not rely on color alone for completed/current state.