Stepper
import { Stepper } from "@cherry-design-system/react";
export function Setup() {
return (
<Stepper
aria-label="Setup"
current={1}
steps={[{ label: "Account" }, { label: "Workspace" }, { label: "Invite" }]}
/>
);
}Stepper shows where the user is in a multi-step flow such as onboarding or checkout. Steps before current are complete, connectors fill as steps complete, and the component has no client JavaScript. For a single value use Progress.
Examples
Vertical with descriptions
import { Stepper } from "@cherry-design-system/react";
export function Checkout() {
return (
<Stepper
aria-label="Checkout"
orientation="vertical"
current={2}
steps={[
{ label: "Cart", description: "3 items" },
{ label: "Shipping", description: "Standard, 3 to 5 days" },
{ label: "Payment", description: "Card or bank transfer" },
{ label: "Review" },
]}
/>
);
}Overriding a step's state
A step's state overrides the one derived from current, for example to keep a skipped step marked as upcoming.
import { Stepper } from "@cherry-design-system/react";
export function Onboarding() {
return (
<Stepper
aria-label="Onboarding"
current={2}
steps={[
{ label: "Profile" },
{ label: "Integrations", state: "upcoming" },
{ label: "Done" },
]}
/>
);
}Translated state labels
Each step announces its state in text. labels replaces the defaults ("Completed", "Current step", "Not started").
import { Stepper } from "@cherry-design-system/react";
export function Pasos() {
return (
<Stepper
aria-label="Registro"
current={0}
labels={{ complete: "Completado", current: "Paso actual", upcoming: "Sin empezar" }}
steps={[{ label: "Cuenta" }, { label: "Equipo" }]}
/>
);
}Properties
The steps, in order. Each is { label: ReactNode; description?: ReactNode; state?: "complete" | "current" | "upcoming" }. state overrides the state derived from current.
Index (0-based) of the current step. Earlier steps are complete.
Layout direction. Defaults to "horizontal".
Screen-reader words for each state. Translate here.
Stepper renders an <ol>, forwards its ref and passes every other <ol> attribute through. It is safe in Server Components.
Styling
| Hook | Values |
|---|---|
| Class | cherry-stepper |
data-orientation | horizontal, vertical |
data-state (on each step) | complete, current, upcoming |
| States | [aria-current="step"] |
| Parts | cherry-stepper__step, cherry-stepper__marker, cherry-stepper__check, cherry-stepper__number, cherry-stepper__connector, cherry-stepper__text, cherry-stepper__label, cherry-stepper__description |
Completed and current markers read --cherry-primary-default and --cherry-primary-fg; upcoming markers and connectors use --cherry-bg-muted and --cherry-border-default.
Accessibility
The current step is aria-current="step". Each step states whether it is complete, current or not started in text (labels), not only with the check mark. Name the list with aria-label when the page has more than one.