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.
Props
Meter 16 props
What the amount is: the meter's name. Untrusted text, rendered as text.
The amount.
The limit.
Replaces the state marks.
Ref to the outermost element.
The outermost element's id.
The least amount.
From here the meter shows its warning state, with a mark and words.
Formats the amount and the limit.
Under the track: what is left, in the app's words ("24.4 GB left").
Text
Words it shows and says. A
LabelsProvidersets them for the whole app.The id of what describes the meter.
The id of what gives more about it.
Classes for the outermost element. Wins over the defaults via
cn().Classes for each part.
The label, the meter's name.
The
role="meter"element: the figure and the track (in aMeterListrow, the track).The amount and the limit beside it.
The amount.
The limit's words beside the amount ("of 100 GB").
The track the fill runs along.
The fill, to the amount's share.
The mark at
warningAt.The line under the track: the state's words, then the app's note.
The state's words past
warningAtor the limit.The state's mark beside its words.
Inline styles for the outermost element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
MeterList 13 props
The rows, in the app's order.
Formats each amount and limit.
Replaces the rows' state marks.
Ref to the outermost element.
The outermost element's id.
Text
Names the list.
The id of what names the list.
The id of what describes the list.
The id of what gives more about it.
Words it shows and says. A
LabelsProvidersets them for the whole app.
Classes for the outermost element. Wins over the defaults via
cn().Classes for each part.
The list of rows.
Each row.
Each row's name.
The amount and the limit beside it.
The
role="meter"element: the figure and the track (in aMeterListrow, the track).The track the fill runs along.
The amount.
The state's words past
warningAtor the limit.The line under the track: the state's words, then the app's note.
The limit's words beside the amount ("of 100 GB").
The fill, to the amount's share.
The mark at
warningAt.The state's mark beside its words.
Inline styles for the outermost element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
Spec status
Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.
| Item | Status | Details |
|---|---|---|
Fine, close to the limit and over it (warningAt, max) | Built | Configuration · Storage |
A note under the track (note) | Built | Configuration · Storage |
Several amounts, each against its own limit (MeterList) | Built | Variant · Limits |
| A list in a narrow container, each track under its name | Built | Configuration · Limits |
| A new amount | Built | Use case · Changing |
| Not an M3 component | Extension | M3 has no meter or chart components; this is a role="meter" from React Aria, drawn in M3’s colour roles, shapes and springs, with the theme’s warning and error roles for its states. |
| States in words | Extension | Near the limit and past it, the meter shows a mark and words and says them in its value text, never colour alone. |
Fine, close to the limit and over it (
BuiltwarningAt,max)Configuration · Storage
A note under the track (
Builtnote)Configuration · Storage
Several amounts, each against its own limit (
BuiltMeterList)Variant · Limits
A list in a narrow container, each track under its name
BuiltConfiguration · Limits
A new amount
BuiltUse case · Changing
Not an M3 component
ExtensionM3 has no meter or chart components; this is a
role="meter"from React Aria, drawn in M3’s colour roles, shapes and springs, with the theme’s warning and error roles for its states.States in words
ExtensionNear the limit and past it, the meter shows a mark and words and says them in its value text, never colour alone.
Theming & tokens
Set the tokens below on the meter, the list or any ancestor; a MeterList reads the same set, with three tokens of its own (column-gap, list-figure-gap and name-width). The fill and the marks take the shared chart tokens: --wm-chart-color-1 while fine, --wm-chart-warning and --wm-chart-critical past warningAt and max. The track and the notch are drawn from --wm-chart-surface: on a card of another colour than surface, set it to the card's. className goes on the root; style a meter's parts with classNames: label, meter, figure, value, limit, track, fill, notch, note, status, statusIcon. A MeterList's classNames take each row's parts too, with list, row, name in place of label.
| Variable | Default | Paints |
|---|---|---|
--wm-meter-gap | 8px | The space between the figure, the track and the note. |
--wm-meter-figure-gap | 8px | The space between the amount and the limit beside it. |
--wm-meter-note-gap | 8px | The space between the state’s words and the note after them. |
--wm-meter-status-gap | 4px | The space between the state’s mark and its words. |
--wm-meter-column-gap | 16px | In a MeterList, the space between the names, the tracks and the figures. |
--wm-meter-list-figure-gap | 4px | In a MeterList, the space between a row’s amount and its limit. |
--wm-meter-track-height | 8px | The track’s height. |
--wm-meter-track-shape | var(--md-sys-shape-corner-full) | The track’s and the fill’s corners. |
--wm-meter-track-color | color-mix(in srgb, var(--md-sys-color-on-surface) 12%, var(--_wm-chart-surface)) | What is left: the track behind the fill, a step off the surface it is drawn on (a frame’s card too). |
--wm-meter-notch-width | 2px | The gap of the chart’s surface that marks `warningAt` on the track. |
--wm-meter-label-color | var(--md-sys-color-on-surface-variant) | What the amount is. |
--wm-meter-value-color | var(--md-sys-color-on-surface) | The amount. |
--wm-meter-limit-color | var(--md-sys-color-on-surface-variant) | The limit beside the amount. |
--wm-meter-note-color | var(--md-sys-color-on-surface-variant) | The note under the track (what is left), and the status words. |
--wm-meter-status-icon-size | 18px | The mark beside the status words near or over the limit. |
--wm-meter-fill-duration | var(--md-sys-motion-spring-spatial-default-duration) | How long the fill takes to grow or shrink to a new amount. |
--wm-meter-fill-easing | var(--md-sys-motion-spring-spatial-default-easing) | The easing of that change. |
--wm-meter-name-width | 12rem | In a MeterList, the most the names’ column takes before the tracks. |