Meter
ProA value on a known scale, such as storage used or a quota, with a warning past a threshold said in words, never by colour alone. Not an M3 component (@windmorph/react-pro).
import { Meter, MeterList } from '@windmorph/react-pro/charts';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Purpose
One amount against a known limit: storage used, seats taken, a month's minutes. The amount is the headline, the limit sits beside it, a track shows the share, and a line under it can say what is left. Near the limit and past it, the meter says so in words with a mark, never by colour alone. A pie of two slices would say less. A MeterList shows several amounts, each against its own limit.
M3 has no meter or chart components, so this one follows M3's colour roles, shapes and springs instead of a spec. For how far a task has got, such as an upload, use a Progress indicator: it reports work under way, where a meter reports a level. For one whole split into a few parts, use a Segmented bar; to let people choose a number, a Slider.
Behaviour
valueis measured againstmax, the limit, frommin(0 by default).formatValuewrites the amount and the limit, by default in the nearestLocaleProvider's locale, else the browser's; give it the unit ("75.6 GB"), since screen readers hear the same words. The limit shows aslabels.of("of 100 GB").- From
warningAtthe meter is in its warning state: the fill takes the warning colour and the line under the track sayslabels.near("Close to the limit") with a mark. A notch in the track marks where it starts. Pastmaxit is critical, in the error colour, withlabels.over("Over the limit"); the track stays full and the figure keeps the real amount. A warning point outside the range is ignored.data-stateon the root (on each row, in a list) isfine,warningorcritical. notegoes under the track, after the state's words, in your own words: what is left ("24.4 GB left"), or what to do. That line is kept even while it is empty, on every meter and everyMeterListrow, with awarningAtor without, since any amount can pass its limit: the state's words appear without moving what is below.- The fill grows from the start the first time the meter comes into view, while the number counts up from
min; a new amount moves both from where they are. A meter on screen as the page loads shows its final picture from the server's HTML, with nothing replayed. Under reduced motion the meter shows its final picture at once, wherever it is on the page. - An amount or a limit that isn't a number reads
labels.noValue("No value") and draws an empty track, never "NaN".iconsreplaces the warning and critical marks. MeterListtakesrowsofkey,label,value,max, and optionallymin,warningAtandnote; each row warns as a meter does. Names, tracks and figures are three columns of one grid, so every track lines up, and the names' column takes at most 12rem. In a container narrower than 28rem each track drops under its name, so the list fits a side panel. Keep each row'skeyas its amount changes; a development build warns when two rows share one, or when a row'sminis above itsmax, as it does for a meter.- Name a
MeterListwitharia-labeloraria-labelledby, or put it in a Chart frame, whose title names it; a development build warns about a list with neither.
When not to use
For a task's progress, use a Progress indicator; for one whole split into parts, a Segmented bar.
See also
- Stat tile: One number and how it moved: what it is, the figure, its change against something, and a small trend under the number. Not an M3 component (@windmorph/react-pro).
- Progress indicators: Linear and circular indicators, determinate or indeterminate, flat or wavy.
- Segmented bar: One whole in a few parts, as a bar that prints its figures or a thin bar above a list of the parts; parts with an order can take the theme's ramp, lightest to darkest (the reverse in dark mode). Not an M3 component (@windmorph/react-pro).