Components

Meter

Shows a quantity within a known range, such as storage used or a plan’s quota, and turns orange or red near the limit.

Usage

import { Meter, MeterLabel, MeterTrack, MeterValue } from 'nyctoui/meter'

<Meter value={18.4} max={50}>
  <MeterLabel>Storage</MeterLabel>
  <MeterValue />
  <MeterTrack />
</Meter>

Meter looks like Progress but means something else: it reports a level, not a task moving toward done. Screen readers announce it as a meter. For uploads, imports and playback, use Progress.

Good for

  • Storage used on an account page in a cloud drive.
  • Seats used on a team plan, on the billing page.
  • API requests used against a monthly quota in a developer console.
  • A password strength reading under a new password field.

Examples

Custom value

MeterValue shows a percentage unless the root has a format. Pass a function to write it your own way, and getValueLabel so screen readers hear the same thing.

Tones

The demo at the top of the page. tone colors the indicator 'warning' or 'danger'. It is status only, so the meter doesn’t pick it; decide the thresholds where you know what the limit means, as this example does at 80% and 95%.

Best practices

Do
  • Use a meter for a level within a known range, and Progress for a task moving toward done.
  • Show the value in words beside the bar, like “7.2 of 10 GB”, with format or getValueLabel.
  • Let the tone turn orange or red near the limit, and say what to do next, such as a link to upgrade.
Don’t
  • Use a meter for an upload or an import. That’s progress.
  • Rely on the color alone to say the limit is close. Put it in the text.

API reference

Meter

Wraps ui-sdk’s Meter and takes its props, including format, locale and getValueLabel.

PropTypeDefault
value
Current value, clamped to min and max.
number—
min
Value at an empty bar.
number0
max
Value at a full bar.
number100
tone
Indicator color, for a level close to or over its limit.
'neutral' | 'warning' | 'danger''neutral'
format
How the value is written in MeterValue and for screen readers.
Intl.NumberFormatOptions—
getValueLabel
What a screen reader announces for the value.
(value: number, details: { formatted, percent, min, max }) => string—
sx
StyleX styles merged after the built-in ones.
StyleXStyles—

MeterLabel

A <span> in the first row that labels the meter.

PropTypeDefault
sx
StyleX styles merged after the built-in ones.
StyleXStyles—

MeterValue

A <span> at the end of the first row showing the formatted value.

PropTypeDefault
children
Write the value yourself instead of the default.
(state: { value, text, … }) => ReactNode—
sx
StyleX styles merged after the built-in ones.
StyleXStyles—

MeterTrack

The full-width track, with the indicator inside.

PropTypeDefault
sx
StyleX styles merged after the built-in ones.
StyleXStyles—