Components
Stepper
Shows where someone is in a multi-step flow and lets them go back.
Free
pnpm dlx shadcn@latest add @caliper/stepperWhen to use
Use it for
- Onboarding, checkout and set-up flows with two to six steps.
- A step can fail and needs an inline error.
Skip it when
- The steps are not sequential; use tabs.
- The flow is a single form; use sections.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/stepper
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
example.tsx
import { useState, type ReactNode } from "react" import { Button } from "@/components/ui/button" import { cn } from "@/components/ui/lib/cn" import { Stepper } from "@/components/ui/stepper" function Panel({ title, context, action, className, children }: { title: string; context: string; action?: ReactNode; className?: string; children: ReactNode }) { return ( <section className={cn("grid w-full max-w-md gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting", className)}> <div className="flex items-start justify-between gap-3"> <div className="grid min-w-0 gap-1"> <p className="font-medium">{title}</p> <p className="text-sm text-muted-foreground">{context}</p> </div> {action} </div> {children} </section> ); } const onboarding = [ { id: "account", label: "Account", description: "Name and email" }, { id: "workspace", label: "Workspace", description: "Where the work lives" }, { id: "plan", label: "Plan" }, ]; const stepBodies = [ ["Mara Chen", "mara@halden.example · signed in with Google"], ["Halden Studio", "halden.app/studio · 4 teammates invited"], ["Team plan", "$12 per seat each month · 14-day trial"], ["All set", "Your workspace is ready. Invites go out now."], ]; export function OnboardingSteps() { const [step, setStep] = useState(1); const [title, detail] = stepBodies[step]!; return ( <Panel title="Set up Halden" context="Takes about two minutes" className="max-w-xl"> <Stepper steps={onboarding} current={step} onStepSelect={setStep} /> <div className="grid gap-0.5 rounded-control border border-border px-4 py-3 text-sm"> <span className="font-medium">{title}</span> <span className="text-muted-foreground">{detail}</span> </div> <div className="flex justify-end gap-2"> <Button size="sm" variant="ghost" disabled={step === 0} onClick={() => setStep((value) => Math.max(0, value - 1))}>Back</Button> <Button size="sm" disabled={step === onboarding.length} onClick={() => setStep((value) => Math.min(onboarding.length, value + 1))}>Continue</Button> </div> </Panel> ); }
API reference
Stepper
component
PropTypeDefault
steps *readonly Step[]—
current *number—
orientation"horizontal" | "vertical""horizontal"
onStepSelect((index: number) => void)—
labelstring"Progress"
completeLabelstring"All steps complete"
classNamestring—
Accessibility
It is built on native elements and keeps aria-label, aria-live, aria-hidden, aria-current and aria-disabled in step with state. Changes that matter are announced through a live region.
KeyBehaviour
→Moves to the next item or value.
↓Moves to the next item or value.
←Moves to the previous item or value.
↑Moves to the previous item or value.
HomeJumps to the first item or the minimum.
EndJumps to the last item or the maximum.
Motion
Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.