Content
- Name the reading in
label, such as “Soil moisture”. - Put the figure in
valueand its unit inunit, so the unit sets lighter. - Give every bar in a stack the same unit and decimal places.
One reading judged against a threshold, such as soil moisture against its refill point.
Walk the value across the threshold, then move the readout to the head of the fill.
<MeasureBar
label="Soil moisture"
pct={42}
value="42"
unit="%"
threshold={50}
fill={RAMP.green[800]}
fillBelow={RAMP.squash[1000]}
scale={['0', '50', '100']}
/>Progress is a 32px instrument for one reading against a threshold. For a job with an end, use the slim Progress bar.
A black line marks the point the reading is judged against. Pass fillBelow so the bar changes colour under the line. Keep the line clear of an end readout, which sits over it.
<MeasureBar label="Soil moisture" pct={34} threshold={50} fill={RAMP.green[800]} fillBelow={RAMP.squash[1000]} value="34" unit="%" scale={['0', '50', '100']} />
<MeasureBar label="Soil moisture" pct={71} threshold={50} fill={RAMP.green[800]} fillBelow={RAMP.squash[1000]} value="71" unit="%" scale={['0', '50', '100']} />The value sits in a white pill, so it reads over the fill and the track alike.
<MeasureBar label="Soil moisture" pct={18} value="18" unit="%" />
<MeasureBar label="Soil moisture" pct={42} value="42" unit="%" />
<MeasureBar label="Soil moisture" pct={68} value="68" unit="%" />
<MeasureBar label="Soil moisture" pct={18} value="18" unit="%" readoutAt="head" />head on a lone bar.<BarPill value="42.1" unit="%" />label, such as “Soil moisture”.value and its unit in unit, so the unit sets lighter.The bar is a meter: a screen reader hears its label and the readout, such as “34%”. Under reduced motion the fill doesn’t sweep or ease.
| Key | What it does |
|---|---|
| Tab | Passes over the bar. It never takes focus. |
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | — | Required accessible name, such as the reading. |
| pct | number | — | Fill, from 0 to 100. |
| value | string | — | The readout. Leave out for a bare bar. |
| unit | string | — | Shown after the value, in lighter ink. |
| readoutAt | 'end' | 'head' | 'end' | Readout at the track end, or at the fill's end. |
| threshold | number | — | Where the black line sits, from 0 to 100. |
| fill | string | blue-1000 | Fill colour; with fillBelow, only at or over the threshold. |
| fillBelow | string | — | Fill colour under the threshold. |
| track | string | grey-300 | Track colour. |
| scale | string[] | — | Marks under the bar, at even positions. |
BarPill The readout on its own.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | The figure, already formatted. |
| unit | string | — | Shown after the value, in lighter ink. |
| Token | Value | Where it lands |
|---|---|---|
| --global-blue-1000 | #1877F2 | Default fill. |
| --global-green-800 | #019939 | Fill at or over the threshold. |
| --global-squash-1000 | #9D6508 | Fill under the threshold. |
| --global-neutral-grey-300 | #F1F1F1 | The track. |
| --global-neutral-grey-1300 | #0A090B | Threshold line and value. |
| --global-neutral-grey-1000 | #4F4D55 | Scale marks and unit. |
| --global-base-white | #FFFFFF | Readout pill and threshold edge. |
| --radius-md | 6px | Track and pill corners. |
| --font-weight-extrabold | 700 | Readout value. |
| (no token) | 32px | Track height. |
| (no token) | 800ms | Fill sweep and change. |