Skip to content

Feedback

Meter

A measurement within a known range, such as disk usage.

import { Meter } from '@var-ui/react';
Storage used42%
Seats88%

Meter

A bar showing a scalar value inside a known range: disk usage, battery level, a password strength score. It is not progress: nothing is advancing toward completion, and the color says whether the value is good, not how far along it is.

It follows the HTML <meter> vocabulary: value, min, max, low, high and optimum.

Examples

Default

min is 0 and max is 100. label is the visible label and the accessible name; the formatted value sits beside it (hide it with showValueText={false}).

Storage used42%
Demo.tsxTSX
import { Meter } from '@var-ui/react';

<Meter label="Storage used" value={42} />

Thresholds

low and high split the range into three regions, and optimum says which one is best. The tone is derived the way browsers do for <meter>: a value in the optimum region is success, in the neighbouring region warning, and on the far side danger. With optimum high, as in the password strength example, the scale is reversed. Set tone to override the derived tone, and valueLabel to replace the value text.

Disk usage30%
Disk usage65%
Disk usage92%
Password strengthStrong
Demo.tsxTSX
import { Meter, Stack } from '@var-ui/react';

<Stack gap="md">
  <Meter label="Disk usage" value={30} low={50} high={80} optimum={0} />
  <Meter label="Disk usage" value={65} low={50} high={80} optimum={0} />
  <Meter label="Disk usage" value={92} low={50} high={80} optimum={0} />
  <Meter label="Password strength" value={85} low={40} high={70} optimum={100} valueLabel="Strong" />
</Stack>

Sizes

size sets the track height: sm, md (default) or lg. appearance="subtle" softens the fill.

Small50%
Medium50%
Large50%
Demo.tsxTSX
import { Meter, Stack } from '@var-ui/react';

<Stack gap="md">
  <Meter label="Small" value={50} size="sm" />
  <Meter label="Medium" value={50} size="md" />
  <Meter label="Large" value={50} size="lg" tone="accent" />
</Stack>

Meter or ProgressBar

UseComponent
An operation advances to completionProgressBar
The same, in a ringProgressCircle
A reading in a range, no task in flightMeter

Astro

Meter from @var-ui/astro renders the same DOM, classes and derived tone. It outputs role="meter"; the React component adds progressbar as a fallback (meter progressbar, React Aria’s choice) for assistive technology that does not know meter.

Props

Accessibility

  • A div with role="meter" and aria-valuemin, aria-valuemax, aria-valuenow and aria-valuetext, built on React Aria’s Meter. The native <meter> element is not used: its fill can only be styled through engine-specific pseudo-elements that differ between browsers.
  • aria-valuenow is clamped to the range. ARIA has no low, high or optimum, so the good/bad judgement is visual: pair it with a valueLabel such as “Almost full” or “Strong” when the state matters.
  • The tone is also available as data-tone for your own styling.
  • Forced colors: the track gets a border and the fill uses Highlight, so the proportion stays readable.
  • The meter is not focusable and has no keyboard interaction.