About
A multi-step progress indicator for forms and flows that marks finished, current and upcoming steps, lets users go back to a completed step, and can show a step with an error in place of its description.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Stepper to your project and fits it to your theme.
Code
How Stepper is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import * as React from "react";
import Stepper from "@/components/ui/stepper";
const steps = [
{ label: "Reader", description: "Who is borrowing" },
{ label: "Manuscript", description: "What to copy" },
{ label: "Collection", description: "When and where" },
{ label: "Review", description: "Check and send" },
];
export default function StepperFlowDemo() {
const [current, setCurrent] = React.useState(0);
const headingRef = React.useRef<HTMLHeadingElement>(null);
function go(to: number) {
setCurrent(to);
requestAnimationFrame(() => headingRef.current?.focus());
}
return (
<div className="grid w-full max-w-xl gap-6">
<Stepper
steps={steps}
current={current}
onstep={go}
label="Borrowing request"
/>
<div className="grid gap-3">
<h3
ref={headingRef}
tabIndex={-1}
className="m-0 text-sm font-semibold outline-none"
>
{steps[current].label}
</h3>
{current === 0 && (
<label className="grid gap-1 text-sm text-muted-foreground">
Name
<input
className="rounded-md border bg-transparent px-3 py-2 text-foreground"
defaultValue="Maryam al-Ijliya"
readOnly
/>
</label>
)}
{current === 1 && (
<label className="grid gap-1 text-sm text-muted-foreground">
Manuscript
<input
className="rounded-md border bg-transparent px-3 py-2 text-foreground"
defaultValue="Book of Optics"
readOnly
/>
</label>
)}
{current === 2 && (
<label className="grid gap-1 text-sm text-muted-foreground">
Reading room
<input
className="rounded-md border bg-transparent px-3 py-2 text-foreground"
defaultValue="Bayt al-\u1e24ikma, Baghdad"
readOnly
/>
</label>
)}
{current === 3 && (
<p className="m-0 text-sm text-muted-foreground">
Maryam al-Ijliya \u00b7 Book of Optics \u00b7 Bayt al-\u1e24ikma,
Baghdad
</p>
)}
</div>
<div className="flex justify-end gap-2">
<button
type="button"
className="rounded-md px-3 py-2 text-sm font-medium disabled:opacity-40"
disabled={current === 0}
onClick={() => go(current - 1)}
>
Back
</button>
{current < steps.length - 1 ? (
<button
type="button"
className="rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground"
onClick={() => go(current + 1)}
>
Continue
</button>
) : (
<button
type="button"
className="rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground"
onClick={() => go(0)}
>
Send request
</button>
)}
</div>
</div>
);
}
















