import * as React from "react";
import {cn} from "@/lib/utilities";
import styles from "./stepper.module.css";
/**
* Represents the configurable props for the {@link Stepper} component.
*
* @remarks
* Extends native `
` attributes so step progress indicators can expose data
* attributes, testing hooks, and ARIA metadata while remaining layout-flexible.
*/
interface StepperProps extends React.HTMLAttributes {
/**
* Labels for each step in the progress sequence.
*/
steps: ReadonlyArray;
/**
* Zero-based index of the currently active step.
*/
activeStep: number;
/**
* Visual orientation of the stepper layout.
*
* @default "horizontal"
*/
orientation?: "horizontal" | "vertical";
}
/**
* Displays a multi-step progress indicator for wizard-like workflows.
*
* @remarks
* **Rendering Context**: Server- and client-compatible presentational component.
*
* Renders a semantic list of steps and marks each item as completed, active, or upcoming
* based on the supplied zero-based active index. Use it to communicate progress across
* onboarding flows, checkout funnels, or multi-step forms.
*
* @example
* ```tsx
*
* ```
*
* @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/progressbar/progressbar.html | WAI progress indicator guidance}
*/
const Stepper = React.forwardRef(
({steps, activeStep, orientation = "horizontal", className, ...props}, ref) => (
{steps.map((label, index) => {
let state: "completed" | "active" | "upcoming" = "upcoming";
if (index < activeStep) {
state = "completed";
} else if (index === activeStep) {
state = "active";
}
return (
{state === "completed" ? "✓" : index + 1}
{index < steps.length - 1 ? (
) : null}
{label}
);
})}
),
);
Stepper.displayName = "Stepper";
export {Stepper};
export type {StepperProps};