A thin progress line for multi-step forms. The completed part is drawn with running dashes, a dot marks the current position, the counter on the left shows the step and the percentage sits on the right. It is a server component with no client JavaScript.
Preview
Profile
Installation
Usage
import { StepProgress } from "@/components/ui/step-progress"
export default function Example() {
return <StepProgress step={4} total={5} />
}Examples
Counter, percentage, animation
Hide the counter or the percentage when the layout already shows them, and stop the dashes with animated={false}. With prefers-reduced-motion the dashes stand still anyway.
<StepProgress step={1} total={4} showCounter={false} />
<StepProgress step={3} total={8} showPercent={false} />
<StepProgress step={6} total={6} animated={false} />Color
Dashes are drawn with currentColor, so a text color class on the component repaints the line.
<StepProgress step={2} total={5} className="text-primary" />
<StepProgress step={4} total={5} label="Uploading files" className="text-muted-foreground" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| step | number | - | Current step, starting from 1 |
| total | number | - | Total number of steps |
| showCounter | boolean | true | Show the 04 / 05 counter |
| showPercent | boolean | true | Show the percentage |
| animated | boolean | true | Run the dashes on the completed part |
| label | string | "Step {step} of {total}" | Accessible label, {step} and {total} are replaced |
| className | string | - | Additional CSS classes |
Features
- progressbar role: aria-valuenow in percent and a readable aria-valuetext
- Reduced motion: the dash animation runs only under motion-safe
- No client code: the keyframes ship in a deduplicated style tag