Progress Tracker
ProgressTracker displays workflow progress as a row of status segments.
import { ProgressTracker } from '@/components/ui/wideset/progress-tracker/ProgressTracker';
<ProgressTracker
steps={[
{ tooltip: { children: 'Cart' } },
{ tooltip: { children: 'Shipping' } },
{ tooltip: { children: 'Payment' } },
{ tooltip: { children: 'Review' } },
{ tooltip: { children: 'Confirmation' } },
]}
activeStep={2}
/>Installation
pnpm dlx wideset add progress-tracker
Copies the component and any Wideset components it uses into your project.
Examples
Statuses
activeStep sets the statuses for you: segments before it are completed, the segment itself is active, the rest are incomplete. Set status: 'error' on a step to flag one the user has to go back and fix; it overrides the computed status and leaves the others alone. Screen readers hear the tracker as a progressbar whose value is activeStep, so keep it pointing at the real step even when you override statuses, and name each step in its tooltip.
import { ProgressTracker } from '@/components/ui/wideset/progress-tracker/ProgressTracker';
export default function ProgressTrackerStatuses() {
return (
<div className="w-[20rem] max-w-full">
<ProgressTracker
activeStep={3}
steps={[
{ tooltip: { children: 'Cart' } },
{ status: 'error', tooltip: { children: 'Shipping' } },
{ tooltip: { children: 'Payment' } },
{ tooltip: { children: 'Review' } },
{ tooltip: { children: 'Confirmation' } },
]}
/>
</div>
);
}API reference
ProgressTracker
| Name | Description | Default |
|---|---|---|
activeStep | Index of the currently active step. Steps before it are marked completed; steps after are incomplete. Clamped to `[0, stepsCount]`. number | 0 |
children | Compose steps manually using `ProgressTracker.Step`. Takes precedence over `steps`. ReactNode | — |
interactive | Renders each step as a `<button>`. Enables hover/active states and `onStepClick`. boolean | false |
onStepClick | Callback fired when a step is clicked. Receives the zero-based `stepIndex`. ((stepIndex: number) => void) | — |
stepAriaLabel | Accessible name of each interactive step button, from its zero-based index. Defaults to `Step 1`, `Step 2`, … ((stepIndex: number) => string) | — |
steps | Array-driven step definitions. Each entry may have an optional `status` override and `tooltip`. Mutually exclusive with `children`. ProgressTrackerStep[] | — |
<div> is passed through to it. See MDN: <div>.ProgressTracker.Step
| Name | Description | Default |
|---|---|---|
status | Visual status of the step segment. When omitted, status is derived automatically from `activeStep`. 'error''completed''incomplete''active' | 'incomplete' |
stepIndex | number | 0 |
tooltip | Tooltip shown on hover. Accepts Tooltip.Content props. TooltipContentProps | — |
<div> is passed through to it. See MDN: <div>.Accessibility
- Non-interactive:
role="progressbar"with valueactiveStepout of the step count. KeepactiveSteppointing at the real step even when you override statuses. - Interactive: a
groupof buttons; setstepAriaLabelto real step names ((i) => names[i]). - Give the tracker an
aria-label; it has no name by default.
| Part | Renders | Description |
|---|---|---|
| ProgressTrackerRenders no element | <div> | A compact row of progress segments with optional tooltips. |
| ProgressTracker.StepRenders no element | <div> | An individual stage in the progress indicator. |
import { ProgressTracker } from '@/components/ui/wideset/progress-tracker/ProgressTracker';
<ProgressTracker
steps={[
{ tooltip: { children: 'Cart' } },
{ tooltip: { children: 'Shipping' } },
{ tooltip: { children: 'Payment' } },
{ tooltip: { children: 'Review' } },
{ tooltip: { children: 'Confirmation' } },
]}
activeStep={2}
/>