Meter
Meters display a scalar value within a known range (storage used, quiz score, or battery level) without implying user input.
Try it
Usage
Set value, min, and max to define the range. Add label text so the measurement is self-explanatory, it is also the accessible name.
import { RuiMeter } from '@ecopages/radiant-ui/meter';
<RuiMeter value={72} min={0} max={100} label="Storage used" />The percent readout is derived from value / min / max and shown next to the bar. value below min or above max is clamped by the native element.
Meter vs progress bar
Use Meter for static measurements. Use a progress element when showing completion of an in-flight task.
Theming
Meters use the surface / text roles from the active theme (--on-surface for the value readout) and the native <meter>'s own appearance for the bar. No status role is applied; the meter is a neutral scalar display, not a status indicator.
<RuiMeter value={72} min={0} max={100} label="Storage used" />Accessibility
- The bar is the native
<meter>element, exposingrole="meter"witharia-valuenow,aria-valuemin, andaria-valuemax. - Include a text label describing what is being measured; the numeric readout is decorative (
aria-hidden="true"). - Supplement the bar with a numeric value when precision matters.
API
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
value | number | 0 | Current value. |
min | number | 0 | Range minimum. |
max | number | 100 | Range maximum. |
label | string | '' | Text describing what is measured (accessible name). |
Slots
The meter is self-contained; label, bar, and value are composed by the element. Pass content via props, not slotted children.
CSS classes
Public BEM classes on the composed light-DOM surface (documented via @cssclass on the element):
| Class | Description |
|---|---|
.rui-meter | Root row (label, bar, value). |
.rui-meter__label | Text describing the measurement. |
.rui-meter__bar | The native <meter>. |
.rui-meter__value | Numeric readout (aria-hidden). |
Theme roles
| Role | CSS variables consumed |
|---|---|
| surface text | --on-surface (value readout) |