Overview
Reference usage
Bounded measurement gauge for fluctuating values like battery, quota, CPU, and memory usage.
Use Meter for static measurements with known bounds (role="meter"). Use Progress for task completion over time (role="progressbar").
Usage
For a measurement that has no numeric reading, provide an unknown verdict. Its label is rendered next to the empty track and included in the status's accessible name. Known verdict levels keep role="meter", the numeric fill, and expose the verdict label through aria-valuetext.
To break a reading into named shares, pass segments. The shares stack from the start of the track, each a lighter tone of the accent, and a legend beneath the track names every share with its amount, so the tones never carry the meaning alone. remainder adds a last legend line for the unfilled track. The reading is the sum of the shares, so value is ignored.
When to use
- Showing a fluctuating value within a known minimum and maximum range.
- Communicating low/optimal/high regions of a bounded measurement.
- Reporting task completion over time such as uploads/imports. Use Progress instead
Examples
Basic meter
Bounded measurement for a fluctuating value.
Custom range
Map the meter to a non-zero bounded range.
Segmented thresholds
Render low, optimal, and high regions while preserving meter semantics for assistive technology.
Stacked shares with a legend
Break one reading into named shares, such as what fills a context window, with the room that is left.
Props
Name | Type | Default | Description |
|---|---|---|---|
verdict | {
level: MeterVerdictLevel;
label: string;
} | Semantic label for a measurement; unknown represents the non-numeric status case. | |
segments | MeterSegment[] | Splits the filled part of the track into named shares and lists them in a legend beneath it,
such as the instructions, conversation and tool results that make up a context window. The
shares stack from the start of the track in the order given, each a lighter tone of the accent,
so the legend carries the meaning and colour never has to. The reading is their sum, so
value is ignored, and threshold regions are not drawn. | |
remainder | {
/** Visible name of the unfilled part, such as `Free`. */
label: string;
/** Text shown beside the label in the legend, such as `124K`. Defaults to what… Show full type{
/** Visible name of the unfilled part, such as `Free`. */
label: string;
/** Text shown beside the label in the legend, such as `124K`. Defaults to what is left of `max`. */
valueLabel?: string;
} | With segments, adds a last legend line for the unfilled track, such as "Free 124K". | |
value | number | 0 | Current measurement value. Defaults to 0. |
min | number | Lower bound for the range. Defaults to 0. | |
max | number | Upper bound for the range. Defaults to 100. | |
low | number | Lower threshold boundary for segmented rendering. | |
high | number | Upper threshold boundary for segmented rendering. | |
optimum | number | Optimal target value. Influences computed state semantics to match native meter expectations. | |
size | 'sm' | 'md' | 'lg' | 'md' | Size token for track height. Default md. |
ariaValueText | text | Human-readable text exposed via aria-valuetext.
When omitted, aria-valuetext is not rendered.
Example: 50% (6 hours remaining). | |
ariaLabel | text | Accessible name applied directly to the meter element when no visible label element is present. | |
ariaLabelledby | text | Id of a visible element that serves as the accessible name for the meter. Prefer this when a visible label exists. |