Meter
A ten-segment bar for a value against a known ceiling.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
A ten-segment bar for a value against a known ceiling.
Import
import { litSegments, Meter } from "@ir/ui";Watch out
- Figma: "Decorative on its own — always pair with a visible value." So this is
aria-hiddenand carries no ARIA value of its own. The number beside it is what a screen reader reads, and duplicating it here would announce the same figure twice. If you ever use a Meter without a visible value, give itrole="meter"and the aria-* attributes yourself — but the design says don't.
Props
| Prop | Type | Required | What it does |
|---|---|---|---|
max | number | The ceiling the value is measured against. MOS is out of 5. |
Do and don't
Always pair it with the number it represents.
Don't — Show a meter on its own and expect it to carry the value.
It moves in 20% steps, so it cannot tell you 3.4 from 3.9 — and it is hidden from screen readers, so on its own it says nothing at all.
Use Progress for work in flight; a meter is for a reading.
Don't — Use a meter for something that is completing — an upload, an import.
Progress implies an end state and a direction. A meter is a measurement that can go back down.
Use it where the maximum is real and known — MOS out of 5, a score out of 100.
Don't — Use a meter for an unbounded number like calls per hour.
The bar is a fraction of something. With an invented ceiling, the fill is an opinion rather than a measurement.
Pass status unknown, so nothing lights and the value reads "—".
Don't — Draw an empty-looking meter when there is no reading.
A meter at zero says the measurement is zero. No reading and a reading of nothing are different facts.
Accessibility
- The meter is aria-hidden and carries no ARIA value of its own, because it is drawn beside a number that already says the value.
- For a standalone meter with no visible number, give it role="meter" and the aria-value* attributes yourself. The component does not guess.
- The unknown and neutral statuses are a colour difference only. If the distinction matters, the surrounding component has to say it in words.
Where it is drawn
Figma — structure from figma, measurements from figma.