Skip to content

ComponentsFeedback

Meter

Shows a measurement within a known range, like storage used, a quota or password strength. The color follows configurable thresholds from success to warning to danger, with a segmented style, custom value text and locale-aware formatting.

React AriaSource
Storage42%
Memory81%
CPU95%

Installation

pnpm dlx shadcn@latest add @desyne/meter

The CLI installs dependencies and any other components this one uses.

Usage

tsx
import { Meter } from "@/components/ui/meter";
tsx
<Meter label="Storage" value={72} />

Without a color, the bar is success below 75%, warning from 75% and danger from 90%. Change the cut-offs with thresholds, or set color to use one fixed tone.

When to use

  • Meter — a level within a known range that can go up or down: disk usage, seats, budget spent, signal or password strength.
  • Progress Bar — the completion of a task that is running and will finish.
  • Spinner and Skeleton — waiting for something to load, where there's no value to show.

Anatomy

tsx
<Meter label="…">          {/* role="meter progressbar" */}
  {/* header: Label + value text */}
  {/* track + fill, or a row of segments */}
</Meter>
PartRendersNotes
Meter<div role="meter progressbar">React Aria Meter. Sets aria-valuenow, aria-valuemin, aria-valuemax and aria-valuetext.
LabelLabel (<span>)Rendered when label is set and used as the accessible name.
Value text<span>The formatted value, or valueLabel. Hidden with showValue={false}.
Track + fill<div> › <div>Muted track with a fill whose width follows the percentage (500ms transition).
Segments<div> × segmentsReplaces the track when segments is set. A segment fills once the value reaches its share of the range.

Examples

Thresholds

thresholds takes two percentages: where the bar turns warning and where it turns danger. They're measured against the percentage of the range, not the raw value.

Error budget used35%
Error budget used62%
Error budget used86%

Fixed color

Set color when the value isn't "good" or "bad", such as a score or a completeness level. color always wins over thresholds.

Profile completeness70%
Match score88%
Seats used96%
Disk usage40%

When low is bad

Thresholds assume higher is worse. For values like battery or health scores, compute the color yourself and pass it in.

Battery12%
Battery28%
Battery84%

Sizes

md (8px) is the default; sm (6px) suits cards, tables and dense dashboards.

Small48%
Medium48%

Segments

segments splits the bar into equal pieces, for battery, signal or rating-style displays. Segments fill in whole steps, so pick a count that divides your range cleanly.

Battery70%
SignalFair
Rack capacity90%

Custom value text

valueLabel replaces the percentage with your own text. It's also used as aria-valuetext, so pass a string that reads well on its own.

Storage7.2 of 10 GB
API requests48.2k / 50k this month

Formatting and ranges

Set minValue and maxValue to work in real units, and formatOptions to format the value in the user's locale. With the default percent style the percentage is shown; any other style formats the raw value.

Monthly budget$3,240
Bandwidth412 GB
Temperature68°C

Without a visible label

In tables and lists, pass aria-label and hide the value with showValue={false} if you show it elsewhere.

us-east-1
64%
eu-west-1
82%
ap-south-1
93%

Recipes

Usage quotas

Plan limits in a billing card. Each meter uses maxValue and a valueLabel in real units, and turns amber and red as it approaches the limit.

Pro plan

Resets on July 1

Seats8 of 10 members
Storage41.6 of 50 GB
Build minutes2,860 of 3,000 min
Projects4 of 20 projects

Password strength

A segmented meter under a TextField, with a color and label computed from a simple score.

At least 8 characters. Mix cases, numbers and symbols.
Strength—

Server health

Compact meters in cards, with a Badge summarizing the worst reading.

web-01

fra1

Healthy
CPU38%
Memory61%
Disk44%

web-02

fra1

Degraded
CPU77%
Memory72%
Disk45%

db-primary

ams3

Critical
CPU54%
Memory91%
Disk83%

Accessibility

  • Renders role="meter progressbar": browsers that support the meter role use it, others fall back to progressbar.
  • aria-valuenow, aria-valuemin, aria-valuemax and aria-valuetext are set for you. aria-valuetext is your valueLabel, or the value formatted with formatOptions.
  • Every meter needs an accessible name: label, aria-label or aria-labelledby.
  • Color reinforces the value but never replaces it; keep the value text visible or describe the state in valueLabel ("Fair", "Critical").
  • Meters aren't live regions. Changes aren't announced until the user reaches the meter.

Styling

Data slots

SlotElement
data-slot="meter"Root
data-slot="label"The visible label

Render props

className accepts a function of the render state (percentage, valueText):

tsx
<Meter
  label="Disk"
  value={value}
  className={({ percentage }) => (percentage >= 90 ? "font-medium" : "")}
/>

Tone variables

The resolved tone sets --tone on the track (or the segment row), and the fill uses bg-(--tone). The track itself is bg-muted.

API Reference

Meter

Prop

Type

Also accepts every prop of React Aria's Meter, such as id, style and aria-describedby.

  • Progress Bar — the progress of a running task.
  • Alert — pair a meter with a warning when a limit is close.
  • Badge — a compact status next to a reading.