Rag Repo Service

Stepper

A wizard-like workflow mechanism that divides content into logical steps.

Work in Progress

The refactored stepper is currently missing some advanced features (like editable steps control or bottom label positioning). These are planned for future updates.

Installation

The Stepper component is part of the @repo/ui package.

# This is an internal component
import { Stepper, Step } from "@repo/ui/components";

Usage

The Stepper component handles the navigation header automatically in horizontal mode and provides an accordion-like experience in vertical mode.

import { Stepper, Step } from "@repo/ui/components";

export default function App() {
  return (
    <Stepper orientation="horizontal">
      <Step label="Step 1">Content 1</Step>
      <Step label="Step 2">Content 2</Step>
    </Stepper>
  );
}

Examples

Interactive Configurator

Play with different props to see how the stepper adapts in real-time.

User details and preferences go here.


Orientation

The stepper supports both horizontal and vertical orientations.

Content for step 1.

Content for step 1.

Linear Mode

Enforce sequential progression. Users can only move forward if the current step is completed.

You must complete this step to proceed.

Optional Steps

Steps can be marked as optional. This is useful for gathering non-essential information.

This step is required.

Error States

Indicate validation issues on specific steps using the hasError prop.

Username is already taken!

Custom Icons

Replace default step numbers with custom icons (e.g., Lucide icons).

Home Step


Form Integration

A complex checkout example using react-hook-form and zod for validation.

API Reference

Stepper Props

NameTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Layout direction of the stepper.
linearbooleanfalseIf true, requires steps to be completed in order.
defaultStepnumber0Initial active step index (uncontrolled mode).
stepnumber-Active step index (controlled mode).
onStepChange(step: number) => void-Callback when step changes.

Step Props

NameTypeDefaultDescription
labelstring-Title displayed in the step header.
descriptionstring-Subtitle displayed below the label.
iconReactNode-Custom icon for the step indicator.
optionalbooleanfalseMarks the step as optional.
optionalLabelstring-Text to show when optional (e.g., 'Optional').
completedbooleanfalseForce the step to be marked as completed.
hasErrorbooleanfalseShow error state only for this step.
disabledbooleanfalseDisable interactions with this step.

useStepper Hook

Allows access to the stepper state from any child component.

PropertyTypeDescription
activeStepnumberCurrent active step index (0-based).
totalStepsnumberTotal number of steps.
orientation"horizontal" | "vertical"Current orientation layout.
nextStep() => voidFunction to proceed to the next step.
prevStep() => voidFunction to go back to the previous step.
setActiveStep(index: number) => voidManually set the active step index.
reset() => voidReset stepper to the first step.

On this page