Skip to main content

Meter

The Meter component visualizes a scalar measurement within a known range. Unlike Progress, which shows task completion, Meter displays current values like disk usage, battery level, or temperature.

Import

Anatomy

The Meter component consists of five parts:
  • <Meter.Root> - The container that provides context
  • <Meter.Track> - The background track
  • <Meter.Indicator> - The filled portion showing the value
  • <Meter.Label> - A label for the meter
  • <Meter.Value> - Displays the formatted value

Basic Usage

Key Features

  • Accessible: Uses the ARIA meter role for screen readers
  • Formatted values: Automatic number formatting with Intl.NumberFormat
  • Customizable range: Configure min and max values
  • Locale support: Format numbers according to user locale
  • Unstyled: Complete styling control

Component Props

Root

The root container that manages the meter state and provides accessibility attributes. Props:
  • value (number, required): The current value
  • min (number): The minimum value (default: 0)
  • max (number): The maximum value (default: 100)
  • format (Intl.NumberFormatOptions): Options to format the value
  • locale (Intl.LocalesArgument): The locale for number formatting
  • getAriaValueText (function): Custom function to generate aria-valuetext
  • Renders a <div> element with role=“meter”

Track

The background track of the meter. Props:
  • Renders a <div> element
  • Accepts all standard HTML div attributes

Indicator

Visualizes the position of the value along the range. Props:
  • Renders a <div> element
  • Width is automatically set based on the value
  • Accepts all standard HTML div attributes

Label

A label for the meter. Props:
  • Renders a <label> element
  • Automatically associates with the meter for accessibility

Value

Displays the formatted current value. Props:
  • Renders a <span> element
  • Automatically displays the formatted value

Styling

Common Patterns

Color-Coded Meter

Change indicator color based on the value:

Formatted Values

Custom Value Text

Multiple Segments

Vertical Meter