Step Progress
A multi-step progress indicator in three looks: a segmented bar with a label, numbered circles joined by lines, or dots.
npx shadcn@latest add https://ui.develop-better-solutions.com/r/step-progress.jsonDependencies:
lucide-reactStep 2 of 4Objective
- Focus area
- 2Objective
- 3Screening
- 4Review
Usage
step-progress-example.tsx
"use client";
import { useState } from "react";
import { StepProgress } from "@dbs/ui";
const STEPS = [{ id: "a", label: "Focus area" }, { id: "b", label: "Objective" }, { id: "c", label: "Screening" }, { id: "d", label: "Review" }];
export default function StepProgressExample() {
const [i, setI] = useState(1);
return (
<div className="flex w-full max-w-xl flex-col gap-8">
<StepProgress steps={STEPS} current={i} variant="bar" />
<StepProgress steps={STEPS} current={i} variant="numbered" />
<StepProgress steps={STEPS} current={i} variant="dots" />
<div className="flex gap-2">
<button type="button" disabled={i === 0} onClick={() => setI(i - 1)} className="h-10 rounded-full border border-line px-4 text-sm disabled:opacity-40">Back</button>
<button type="button" disabled={i === STEPS.length - 1} onClick={() => setI(i + 1)} className="h-10 rounded-full bg-ink px-4 text-sm text-canvas disabled:opacity-40">Next</button>
</div>
</div>
);
}