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.

Metrics with progress bars in four tonesMetrics with progress bars in four tones

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.

ClassUse for
.ph-metricA label, value and bar together
.ph-metric-header / .ph-metric-valueThe label row and its value
.ph-progressThe 6px track
.ph-progress-fillThe filled part
.ph-progress--successComplete or healthy
.ph-progress--warningGetting close to a limit
.ph-progress--dangerAt or over a limit
.ph-progress--indeterminateBusy 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.