Progress and metrics
On this page
A progress bar shows how much of something is used or done. A metric adds a label and a value above it: storage used, contacts synced, memory in use.


Figure 1: Metrics in the default, success, warning and danger tones
<div class="ph-metric">
<div class="ph-metric-header">
<span>Storage</span>
<span class="ph-metric-value">412 GB of 1 TB</span>
</div>
<div class="ph-progress"><span class="ph-progress-fill" style="--value: 41%"></span></div>
</div>
Set the fill with the --value custom property, as a percentage.
| Class | Use for |
|---|---|
.ph-metric | A label, value and bar together |
.ph-metric-header / .ph-metric-value | The label row and its value |
.ph-progress | The 6px track |
.ph-progress-fill | The filled part |
.ph-progress--success | Complete or healthy |
.ph-progress--warning | Getting close to a limit |
.ph-progress--danger | At or over a limit |
.ph-progress--indeterminate | Busy with no known end (see Loading) |
Accessibility
For a bar on its own, add role="progressbar", aria-valuenow, aria-valuemin, aria-valuemax
and an aria-label. In a .ph-metric, the visible label and value already say it.
React
import { MetricBar, usageSeverity } from 'ph-app-kit-react';
<MetricBar label="Storage" percent={41} valueText="412 GB of 1 TB" severity={usageSeverity(41)} />
Guidelines
- Always show the value as text too; the bar alone isn't enough.
- Pick the tone from fixed thresholds and use the same ones across the app.
- For one value against a limit on a dashboard, a gauge chart is the alternative.