Progress indicator
Shows the steps of a wizard or setup flow and which one people are on. For a record's stages, use Path.
Installation
The CLI installs the Radix or Base UI file to match your project, with what it builds on: tooltip.
If your project doesn't have Wisty UI's theme yet, add it once with npx shadcn@latest add @wisty/cosmos. Until then, components keep shadcn's default look. Installation has the details.
When to use
Use it
- People work through three or more steps in order, like a new record wizard, a guided setup or an import, and need to see which steps are done, which one they're on and how many are left.
- A step can fail and people need to see which one, like an import step whose file was rejected. Set
erroron it. - People may go back to a finished step. Pass
onValueChange, andselectAheadif they may also skip ahead. - A setup list shows each step's name and a line of detail. Use
orientation="vertical". - It replaces
lightning-progress-indicatorwithtype="base".
Don't use it
- A record moves through its stages, like an opportunity's stage or a lead's status. Use Path.
- You show how much of a task is done as a percentage, like an upload. Use Progress.
- The sections can be visited in any order. Use Tabs.
- There are only two steps, or more than about six. Two steps don't need an indicator. For more, group them into phases and show the phases.
Usage
import {
ProgressIndicator,
ProgressIndicatorContent,
ProgressIndicatorStep,
} from "@/components/wisty/progress-indicator"ProgressIndicator
└── ProgressIndicatorStep
└── ProgressIndicatorContent<ProgressIndicator value={1} aria-label="New opportunity">
<ProgressIndicatorStep label="Contact" />
<ProgressIndicatorStep label="Account" />
<ProgressIndicatorStep label="Review" />
</ProgressIndicator>valueis the current step's index, from 0. Steps before it are complete; the number of steps marks them all complete.- Your app moves
value, usually from Back and Next buttons.onValueChangegets the index of a step someone clicks, so a wizard can go back to it withonValueChange={setStep}. Without it, the markers only show their labels. - Vertical, a step shows its
labelbeside the marker. To add a description or an action, give the step aProgressIndicatorContentas its child, holding the name and the rest; it takes the label's place.
Examples
Step with an error
Setting `error` on the current step replaces its marker with an error mark, and screen readers hear "Account - Error".
On a gray background
With `variant="shade"`, the space around each marker takes the gray background instead of white.
Vertical
A setup list with `orientation="vertical"`: labels beside a line, and a `ProgressIndicatorContent` adding a description to one step.
- CompleteAdd users
- CompleteImport accounts and contacts
- Active
Connect your email
Sync Gmail or Outlook so emails and meetings are logged to the right records.
- Install the Salesforce mobile app
Moving between steps
With `onValueChange`, clicking an earlier step goes back to it, Back and Next move the current step, and later steps stay unavailable.
API reference
| Part | Built on |
|---|---|
ProgressIndicator | <div> (opens in a new tab) |
ProgressIndicatorStep | <li> (opens in a new tab) |
ProgressIndicatorContent | <div> (opens in a new tab) |
ProgressIndicator
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label* | string | Names the process for screen readers, like "New opportunity". | |
variant | "base" | "shade" | "base" | |
orientation | "horizontal" | "vertical" | "horizontal" | |
value* | number | The current step's index, from 0; earlier steps are complete. The step count completes all. | |
onValueChange | (value: number) => void | Called with a step's index when it's clicked. Makes the markers selectable. | |
selectAhead | boolean | false | Lets people select steps after the current one. |
ProgressIndicatorStep
| Prop | Type | Default | Description |
|---|---|---|---|
label* | React.ReactNode | The step's name: the marker's tooltip and name, or the text beside a vertical marker. | |
error | boolean | false | Marks the step as having an error, wherever it is. |
disabled | boolean | false | Keeps people from selecting the step. |
SLDS mapping
ProgressIndicator is slds-progress with the steps as slds-progress__list and the track as an x-small slds-progress-bar with its slds-progress-bar__value. ProgressIndicatorStep is slds-progress__item with its slds-progress__marker, as a button when horizontal, as lightning-progress-indicator renders it. Complete and error steps use slds-progress__marker_icon. ProgressIndicatorContent is slds-progress__item_content. The step's tooltip is Tooltip.
Known gaps:
- The complete and error marks are Lucide's circle check and ban, filled to stand for
utility:successandutility:error. - The vertical indicator's green line (
slds-progress_success), its green check (slds-progress__marker_icon-success) and the borders between steps (slds-progress__list-bordered) aren't variants. Add a bottom border toProgressIndicatorContentfor the borders. lightning-progress-indicator's path type is Path.- The hidden state words ("Completed", "Active", "Error") are English.
| Prop | Value | SLDS | Notes |
|---|---|---|---|
orientation | horizontal (added) | slds-progress, slds-progress-bar slds-progress-bar_x-small | Markers on a track, each label in a tooltip. Default. |
orientation | vertical (added) | slds-progress slds-progress_vertical, slds-progress__item_content | Markers joined by a line, each label beside its marker. |
variant | base (added) | slds-progress | Default. |
variant | shade (added) | slds-progress_shade | For a gray background, like a dialog's footer. |
value | (a step's index) (added) | slds-is-active, earlier steps slds-is-completed | Complete steps show a check (slds-progress__marker_icon). |
error | true (added) | slds-has-error, slds-progress__marker_icon | On a step, in place of its complete, current or incomplete look. |
onValueChange | (set) (added) | slds-progress__marker as a button | Clicking an earlier step moves to it; later steps need selectAhead. |
Accessibility
- Name the process with
aria-label, like "New opportunity". It names both the list of steps and the progress bar. - Each horizontal marker is named by its label and state, like "Contact - Completed" or "Account - Active", so keep state words out of labels. The current step also has
aria-current="step". - Every horizontal marker is a tab stop, so people can reach each tooltip. The arrow keys don't move between steps, as in SLDS.
- With
onValueChange, steps people can't select (later steps withoutselectAhead, anddisabledones) stay focusable and are markedaria-disabled, so their tooltips still open. - Vertical markers aren't focusable. Put any action in the step's
ProgressIndicatorContent.
Responsive behavior
- The horizontal indicator takes 70% of its container's width, centered, as SLDS draws it, and spreads its markers evenly from end to end. In a row with buttons, like a dialog's footer, it takes the space between them.
Rules
- Keep every
ProgressIndicatorStepa direct child ofProgressIndicator, with nothing else between them. A step's position is its index, so a wrapper or fragment counts as one step. - Use
variant="shade"only on a gray background. On white, its gray rings show around every marker. onValueChangeandselectAheadact on horizontal markers only. In a vertical indicator, a step's children are the only way to act on it.- Give every step a short
label, under 30 characters. Horizontal, it's only seen in a tooltip. - Never pass
asChildorrender.
Related
- PathShows a record's stages as chevrons, with the current one and an action.
- ProgressShows how far a task has come, from 0 to 100%.
- Progress ringShows how much of a task is done as a small ring that fills from 0 to 100.
- TabsSwitches between panels of related content.
- TooltipShows a short hint about a control while it has hover or keyboard focus.