Steps
A process with a current step: numbered markers joined by a rail, the steps before aria-current="step" drawn as done and the steps after it as upcoming, in a row when the list is wide and a column when it is narrow.
Example
View Code
<ol class="steps" role="list" aria-label="Checkout">
<li><a href="#">Cart</a></li>
<li aria-current="step">Delivery</li>
<li>Payment</li>
<li>Review</li>
</ol>
When to use it
A process with a place in it: a checkout, an onboarding, a form split over several pages. The visitor sees how many steps there are, which ones are behind them, and which one they are on. A history with no "you are here", such as a changelog, is a timeline.
How it works
An ol with one li per step. Put aria-current="step" on the current step, and the list draws the rest from it: the steps before it are done, the steps after it are upcoming. You never mark a step done by hand. With no aria-current, every step is upcoming. To show a finished process, mark its last step current.
Each step has a numbered marker. A done marker shows a check instead of its number. Done and current markers are filled with the variant, and upcoming markers are an outline. A rail joins the markers: the part between done steps takes the variant, and the rest is the border color.
View Code
<ol class="steps" role="list" aria-label="Checkout">
<li><a href="#">Cart</a></li>
<li aria-current="step">Delivery</li>
<li>Payment</li>
<li>Review</li>
</ol>
A step holds text or a link. A link on a done step lets the visitor go back to it.
The list is a row when it is wide enough and a column below that, by its own width, not the screen's. data-threshold sets the switch and defaults to sm. With more than four steps, or with long labels, raise data-threshold, so the row does not squeeze its labels. In a column, each label sits beside its marker. The demo below switches at lg: drag its frame narrower and the steps stack.
View Code
<ol class="steps" role="list" aria-label="Account setup" data-threshold="lg" data-variant="success">
<li>Account</li>
<li>Profile</li>
<li aria-current="step">Team</li>
<li>Billing</li>
</ol>
data-orientation fixes the direction at any width, and data-threshold no longer applies. vertical keeps a column, such as in a sidebar beside a long form. horizontal keeps a row, so keep its labels short.
View Code
<ol class="steps" role="list" aria-label="Onboarding" data-orientation="vertical">
<li>Create your account</li>
<li aria-current="step">Invite your team</li>
<li>Connect a project</li>
</ol>
data-variant picks the hue of the done and current markers and defaults to primary. data-size sets the text, and the markers scale with it.
Accessibility
Put role="list" on the ol, and an aria-label that names the process. The current step is announced by its aria-current. The numbers and the checks are decoration: they are drawn with empty alternative text, so they never become part of a step's name.
The finished steps are only drawn as finished. Where a visitor must also hear which steps are done, add the word with the visually-hidden utility:
<ol class="steps" role="list" aria-label="Checkout">
<li><a href="#">Cart</a> <span class="visually-hidden">(completed)</span></li>
<li aria-current="step">Delivery</li>
<li>Payment</li>
</ol>
Attributes
| Attribute | Type | Values | Default | Description |
|---|---|---|---|---|
data-variant |
enum | primary, secondary, success, warning, alert, danger, neutral, black, white |
primary |
The hue of the done and current markers and of the rail between done steps. |
data-size |
enum | sm, md, lg |
md |
The text step; the markers scale with it. |
data-threshold |
enum | 3xs, 2xs, xs, sm, md, lg, xl, 2xl |
sm |
The list's own width at or above which the steps sit in a row; below it they stack in a column. |
data-orientation |
enum | horizontal, vertical |
Fixes the steps in a row (horizontal) or a column (vertical) at any width, in place of data-threshold. Absent, the list switches by its width. |
Children
> li: at least 2. One step: its label as text, or a link to a done step. The current step carries aria-current="step".
Tokens
| Token | Description |
|---|---|
--yeti-color-primary |
The default variant's color, when data-variant is absent. |
--yeti-color-primary-subtle |
The default variant's tint. |
--yeti-color-primary-soft |
The default variant's soft stop. |
--yeti-color-primary-strong |
The default variant's strong stop. |
--yeti-color-primary-text |
The default variant's text color. |
--yeti-on-primary |
The number or check on the default variant's fill. |
--yeti-text-md |
Text size when data-size is absent; the markers are twice it. |
--yeti-space-sm |
The space step when data-size is absent: the gap between steps in a row and between a marker and its label in a column. |
--yeti-space-md |
Gap between steps in a column. |
--yeti-space-xs |
Space between a marker and its label in a row. |
--yeti-border-width |
Half the width of a marker's outline and of the rail. |
--yeti-color-border-strong |
Outline of an upcoming marker. |
--yeti-color-border |
The rail from the current step on. |
--yeti-color-text-muted |
Label and number of an upcoming step. |
--yeti-radius-full |
Corner of a marker; a theme that zeroes it gets square markers. |
--yeti-weight-strong |
Weight of a marker's number and of the current step's label. |
Internal tokens (may change between minor versions)
- `--_yeti-marker` - `--_yeti-rail` - `--_yeti-variant` - `--_yeti-variant-subtle` - `--_yeti-variant-soft` - `--_yeti-variant-strong` - `--_yeti-variant-text` - `--_yeti-on-variant` - `--_yeti-size-text` - `--_yeti-size-space`Accessibility
- Required attributes:
role - Put role="list" on the ol, since WebKit stops announcing a list whose markers are gone, and an aria-label naming the process where the page does not already. The current step carries aria-current="step", which is announced; it is also what the drawing follows. The numbers and checks are decoration with empty alternative text, so they never join a step's name. Where a visitor must also hear which steps are finished, add visually hidden text such as "completed" with the visually-hidden utility.
Browser support
- Used without guards: container size queries, :has(), alternative text on generated content, lh unit, logical properties
- Behind
@supports: nothing
JavaScript
None. This component is CSS only.
Available since 7.0.0.