Progress
BetaData displayOpen in the workshop
How far along something is: budget spent, an upload, a goal.
.xg-progress > span (style="--value: 62%") · --success --warning --error · --indeterminateExample and markup
Live, from xg-ui.css and xg-ui.js. Switch the brand and mode on the example itself, or for the whole site in the header.
Markup
<div class="xg-stack" style="max-width:420px">
<div class="xg-field">
<div class="xg-row" style="justify-content:space-between">
<span class="xg-label">Daily budget</span>
<span class="xg-text-sm xg-text-muted xg-num">62% of $5,000</span>
</div>
<div class="xg-progress" role="progressbar" aria-label="Daily budget" aria-valuenow="62" aria-valuemin="0" aria-valuemax="100">
<span style="--value:62%">
</span>
</div>
</div>
<div class="xg-field">
<div class="xg-row" style="justify-content:space-between">
<span class="xg-label">Monthly quota</span>
<span class="xg-text-sm xg-text-muted xg-num">86% of $5,000</span>
</div>
<div class="xg-progress xg-progress--warning" role="progressbar" aria-label="Monthly quota" aria-valuenow="86" aria-valuemin="0" aria-valuemax="100">
<span style="--value:86%">
</span>
</div>
</div>
<div class="xg-field">
<div class="xg-row" style="justify-content:space-between">
<span class="xg-label">Test budget</span>
<span class="xg-text-sm xg-text-muted xg-num">100% of $5,000</span>
</div>
<div class="xg-progress xg-progress--error" role="progressbar" aria-label="Test budget" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
<span style="--value:100%">
</span>
</div>
</div>
<div class="xg-progress xg-progress--indeterminate" role="progressbar" aria-label="Importing">
<span>
</span>
</div>
</div>States
Hover, focus and pressed are forced here with .is-hover, .is-focus and .is-active so they can be seen side by side; in a product they come from :hover, :focus-visible and :active.
| State | Bar |
|---|---|
| Default · 40% | |
| Warning · 86% | |
| Error · 100% | |
| Success · 100% | |
| Indeterminate |
When to use it
Use it for
budget pacing, quota use, file import.
Not for
waits under a second (no indicator) or of unknown length in a button (Spinner).
Rules
- Always print the number next to the bar (“62% of $5,000”).
- Warning at 80%, error at 100% for budgets and quotas.
Accessibility
- role="progressbar" with aria-valuenow/min/max and an accessible name.
Every color pair this component uses is measured for both brands in light and dark on the Accessibility page.
Related
Also in Data display: Data table, Pagination, KPI card, Status badge, Tag, Avatar, Chart, Tooltip, Empty state, Skeleton, Spinner.
Status Beta: usable; class names may still change in a minor release, with a note (see Releasing).