Dice UI

Stepper

A component that guides users through a multi-step process with clear visual progress indicators.

API

Installation

pnpm dlx shadcn@latest add @diceui/stepper
 

Layout

Import the parts, and compose them together.

import {
  Stepper,
  StepperList,
  StepperItem,
  StepperTrigger,
  StepperIndicator,
  StepperTitle,
  StepperDescription,
  StepperSeparator,
  StepperContent,
  StepperPrev,
  StepperNext,
} from "@/components/ui/stepper";
 
return (
  <Stepper>
    <StepperList>
      <StepperItem>
        <StepperTrigger>
          <StepperIndicator />
          <StepperTitle />
          <StepperDescription />
        </StepperTrigger>
        <StepperSeparator />
      </StepperItem>
    </StepperList>
    <StepperContent />
    <StepperPrev /> 
    <StepperNext />
  </Stepper>
)

Examples

Vertical Layout

A stepper with vertical orientation for compact layouts.

With Validation

Use the onValidate prop to validate the current step before moving to the next one.

With Form

A stepper integrated with form validation, showing step-by-step form completion.

API Reference

Stepper

The main container component for the stepper.

Prop

Type

Data AttributeValue
[data-orientation]"horizontal" | "vertical"

StepperList

The container for stepper items, typically an ordered list.

Prop

Type

Data AttributeValue
[data-orientation]"horizontal" | "vertical"

StepperItem

A single step item in the stepper.

Prop

Type

Data AttributeValue
[data-orientation]"horizontal" | "vertical"
[data-state]"inactive" | "active" | "completed"

StepperTrigger

The clickable trigger for each step, typically wrapping the indicator.

Prop

Type

Data AttributeValue
[data-orientation]"horizontal" | "vertical"
[data-state]"inactive" | "active" | "completed"

StepperIndicator

The visual indicator showing the step number or completion status.

Prop

Type

Data AttributeValue
[data-state]"inactive" | "active" | "completed"

StepperSeparator

The line connecting steps, showing progress between them.

Prop

Type

Data AttributeValue
[data-orientation]"horizontal" | "vertical"
[data-state]"inactive" | "active" | "completed"

StepperTitle

The title text for each step.

Prop

Type

StepperDescription

The description text for each step.

Prop

Type

StepperContent

The content area that displays for the active step.

Prop

Type

StepperPrev

A navigation button that moves to the previous step. Automatically disabled on the first step and skips validation when navigating backwards.

Prop

Type

StepperNext

A navigation button that moves to the next step. Automatically disabled on the last step and respects validation rules when navigating forwards.

Prop

Type

Accessibility

Keyboard Interactions

KeyDescription
TabMoves focus to the next focusable element.
Shift + TabMoves focus to the previous focusable element.
EnterSpaceActivates the focused step when clickable is enabled.
ArrowLeftArrowUpMoves focus to the previous step trigger.
ArrowRightArrowDownMoves focus to the next step trigger.
HomeMoves focus to the first step trigger.
EndMoves focus to the last step trigger.

On this page