Design System

Design System

Meter

Indicators

Open in Storybook: Meter (opens in a new tab)

On this page

Overview

A meter shows a measurement inside a known range: fuel level, storage used, battery, a 0–10 intensity, a rating shown on a product card. It is read-only and never takes focus. The component is the native meter: the browser already maps min, max and value to the accessibility tree. A custom look (squares, stars) is painted on top of it and hidden from assistive technology.

The rule. The meter element holds the information; everything else is decoration. Never rebuild the meter out of divs and ARIA.

Anatomy

  1. Label

    label for

    Names the meter. Always visible.

  2. Track

    meter, ::-webkit-meter-bar

    The range from min to max. The meter holds the role, the name, the value and the range.

  3. Fill

    ::-webkit-meter-optimum-value and its two siblings

    Painted by the browser from low, high and optimum: purple is the good zone, yellow the middle, red the worst.

  4. Status

    p aria-hidden="true" with an svg

    Where the value is, in a word and a shape (check, dash, warning), so colour is never the only cue.

  5. Value text

    span aria-hidden="true"

    The visible copy of the value. Hidden because the meter already exposes it.

  6. Marks

    div aria-hidden="true"

    A custom design: squares or stars, one for each unit. The native meter sits invisible over them.

Usage

Use cases

Eight common meters, each the real component and each working: move the slider under one to try a value. Purple is the best zone, yellow the middle, red the worst. The value text, not the colour, carries the status.

  • Fuel level

    Higher is better.

    80 out of 100, good

    Says “80 out of 100, good”.

    min=0 max=100 low=33 high=66 optimum=80 value=80

  • Storage used

    Lower is better.

    12.4 of 16 GB used, filling up

    Says “12.4 of 16 GB used, filling up”.

    min=0 max=16 low=8 high=13 optimum=4 value=12.4

  • Battery

    Higher is better, warn when low.

    15%, low

    Says “15%, low”.

    min=0 max=100 low=20 high=80 optimum=100 value=15

  • Password strength

    0 to 4, higher is better.

    Weak

    Says “Weak”.

    min=0 max=4 low=2 high=3 optimum=4 value=1

  • Coffee intensity

    Custom squares, no zones.

    7 out of 10

    Says “7 out of 10”.

    min=0 max=10 value=7

  • Product rating

    Static info only.

    4 out of 5 stars

    Says “4 out of 5 stars”.

    min=0 max=5 value=4

  • Accessibility score

    Higher is better.

    92 out of 100, good

    Says “92 out of 100, good”.

    min=0 max=100 low=50 high=90 optimum=100 value=92

  • Room humidity

    Middle is best.

    45%, comfortable

    Says “45%, comfortable”.

    min=0 max=100 low=30 high=60 optimum=45 value=45

Props

Props
PropDoesDefault
labelNames the meter. Always visibleRequired
valueThe measurementRequired
maxTop of the rangeRequired
minBottom of the range0
low · high · optimumPassed to the meter as they are. They cut the range into three zonesThe browser’s: min, max, the midpoint
wordsWhat each region is called: { low, middle, high }. With them the field shows the status as a word and a shape, and the word goes into aria-valuetextNone: no status
valueTextThe value in words, (value, max) => string. Empty when the status word is the whole text (“Weak”)“80 out of 100”
shownThe visible copy of the value, (value, max) => string, or null for none“80 / 100”
lookbar, squares or stars. The squares and stars are one for each unit, over an invisible native meterbar

Example

words turns the zone into a word and a shape: this meter says “20 out of 100, low”. look swaps the bar for squares or stars.

import { Meter } from '@/components/Meter'

<Meter
  label="Fuel level"
  value={20}
  max={100}
  low={33}
  high={66}
  optimum={80}
  words={{ low: 'Low', middle: 'Medium', high: 'Good' }}
/>

<Meter label="Intensity" value={7} max={10} look="squares" />

Specs

Measurements

Measurements
PartPropertyValue
FieldGap8px · 12px (0.5rem · 0.75rem)
LabelText13px (0.8125rem) / 1.45, 700
BarHeight · corner20px (1.25rem) · 6px
BarBorder2px solid
FillEdge2px line on its end
SegmentSize · gap10 × 20px · 3px
StarSize · gap20 × 20px, 1.5px line · 4px
StatusText · icon13px (0.8125rem) / 1.4, 600 · 16px icon, 6px gap
Value textText12px (0.75rem) / 1.45, monospace, tabular numbers
Label · value textWidth from 48rem9rem · 11rem at the least

Attributes

min, max and value place the measurement. low and high cut the range into three zones. optimum says which zone is the good one; the other two are ranked by their distance from it.

Attributes
AttributeMeaningDefault
minLowest value of the range0
maxHighest value of the range. Always set1
valueThe current measurement. Keep it between min and max0
lowUpper edge of the “low” zonemin
highLower edge of the “high” zonemax
optimumThe best valueThe midpoint
aria-valuetextThe value in words, with the statusNone: the number is read

Zones

Browsers paint best, middle and worst in green, yellow and red. Here they are purple, yellow and red.

Zones
Optimum isValue below `low`BetweenValue above `high`
Between low and high (middle is best: humidity)middlebestmiddle
Below low (lower is better: storage)bestmiddleworst
Above high (higher is better: fuel, battery)worstmiddlebest

A value on low or high joins the optimum’s region, as the browser paints it: with the optimum below low, a value equal to low is still the best zone. A rule that tests value < low and value > high is wrong on the edges. Chromium 148 paints all 70 combinations tested this way.

Status

Status
Where the value isZoneFillIconWordStatus words, chosen for each meter
Same region as the optimumBestPurpleCheck in a circlePurpleGood · Plenty of space · Comfortable
Next to the optimum regionMiddleYellowDash in a circleInkMedium · Filling up · Too dry · Too humid
Far side from the optimumWorstRedWarning triangleRedLow · Almost full

Layout

A meter is not interactive, so zoom is about reflow: the label, the bar and the value text stay readable and stay together at every width. The breakpoints are container queries in rem, so they follow the room the field has and the size of the text: a field in a narrow card stacks on a wide screen. One DOM at every width, only the CSS changes, so the reading order never changes. In Storybook, pick the width in the viewport menu of the toolbar: 640 CSS px · 200% zoom or 320 CSS px · 400% zoom.

Layout
BreakpointCSS widthReached byLayout
≥ 48rem≥ 768pxDesktop at 100–150% zoomOne row: label · bar · value text
30–48rem480–767px1280px at 200% zoom (640 CSS px) · tablets · text at 200%Label and value text on one row, bar full width below
< 30rem< 480px1280px at 400% zoom (320 CSS px) · phonesStacked: label, bar, value text. No sideways scroll

Markup

<label for="fuel">Fuel level</label>
<meter id="fuel" min="0" max="100" low="33" high="66" optimum="80" value="20"
       aria-valuetext="20 out of 100, low">20 out of 100, low</meter>
<p aria-hidden="true"><svg focusable="false">…</svg> Low · 20 / 100</p>

Styling

One rule for each engine: a selector list that mixes ::-webkit-meter-* and ::-moz-meter-* is dropped whole by the engine that does not know one.

Bar parts
PartWebKit · BlinkFirefox
Wrapper::-webkit-meter-inner-element—
Track::-webkit-meter-barThe element itself
Fill, good zone::-webkit-meter-optimum-value:-moz-meter-optimum::-moz-meter-bar
Fill, middle zone::-webkit-meter-suboptimum-value:-moz-meter-sub-optimum::-moz-meter-bar
Fill, worst zone::-webkit-meter-even-less-good-value:-moz-meter-sub-sub-optimum::-moz-meter-bar
meter { appearance: none; inline-size: 100%; block-size: 1.25rem; }
meter::-webkit-meter-inner-element { appearance: none; block-size: 100%; }
meter::-webkit-meter-bar {
  block-size: 100%;
  background: #e6e6ea;
  border: 2px solid #16161a;
  border-radius: 6px;
}
meter::-webkit-meter-optimum-value,
meter::-webkit-meter-suboptimum-value,
meter::-webkit-meter-even-less-good-value {
  border-inline-end: 2px solid #16161a;   /* where the fill stops */
}
meter::-webkit-meter-optimum-value { background: #5e548e; }
meter::-webkit-meter-suboptimum-value { background: #ffe600; }
meter::-webkit-meter-even-less-good-value { background: #82002a; }
meter:-moz-meter-optimum::-moz-meter-bar { background: #5e548e; }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: #ffe600; }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: #82002a; }

Tokens

Component tokens

Component tokens
PartPropertyTokenValue
BarBorder widthbw2px
BarBorder and fill edge colourink#16161a
BarCorner—6px
TrackFill—#e6e6ea
Fill, bestFilllilac#5e548e
Fill, middleFillmarker#ffe600
Fill, worstFilldanger#82002a
Segment, onFill—#5d5fef
Segment, offBorder · fill— · white#6b6b75 · #ffffff
StarFilled · outline—#5d5fef · #6b6b75
LabelText colourink#16161a
Value textText colourink-soft#4b4b55
Status, bestText and iconlilac#5e548e
Status, middleText · iconink · marker#16161a · #ffe600
Status, worstText and icondanger#82002a

Guidelines

Meter or something else

Meter or something else
ElementUse it forThe user changes itRoleExamples
meterA measurement inside a known rangeNometerFuel 80 / 100 · 12.4 of 16 GB used · 3.5 out of 5 stars on a product card · a password-strength or audit score · humidity in a comfort range
progressCompletion of a taskNoprogressbarUpload at 40% · step 2 of 5 of an install · indeterminate loading
input type="range"Picking a value on a continuous scaleYes, keyboard and pointersliderVolume · brightness · price filter
Radio groupPicking one of a few discrete optionsYes, arrow keysradiogroup, radio“Rate this coffee” 1–5 stars · cup size S / M / L
Plain textA number with no known rangeNo—1,204 followers

If the user can change the value, it is a form control, even when the design makes it look like a meter.

Controls by scenario and context

Each row is a use case, drawn with the real component at half size. The status word moves under the bar for room; it is never dropped.

  • Solid: required in that context, never dropped

Zoom 400% · 320 CSS px. At 200% text size the layout drops to the middle column by itself.

  • Fuel level

    Higher is better

    Live example

    Desktop · 768 px and up48rem · one row

    Label · bar · value text · status word

    low 33 · high 66 · optimum 80. aria-valuetext “80 out of 100, good”.

    Smaller viewport · 480–767 px30–48rem

    Label · bar · status word below

    Bar fills the column; the status word moves under it.

    Zoom 400% · 320 CSS pxUnder 30rem · stacked

    Label · bar · status word

    Label and value text wrap above the bar. Status never by colour alone.

  • Storage used

    Lower is better

    Live example

    Desktop · 768 px and up48rem · one row

    Label · bar · value text · status word

    low 8 · high 13 · optimum 4. “12.4 of 16 GB used, filling up”.

    Smaller viewport · 480–767 px30–48rem

    Label · bar · status word below

    Same zones; value text on its own line.

    Zoom 400% · 320 CSS pxUnder 30rem · stacked

    Label · bar · status word

    “12.4 of 16 GB” wraps; nothing truncated.

  • Battery

    Higher is better, warn when low

    Live example

    Desktop · 768 px and up48rem · one row

    Label · bar · value text · status word

    low 20 · high 80 · optimum 100. “15%, low”: low is a word, not only red.

    Smaller viewport · 480–767 px30–48rem

    Label · bar · status word below

    Same.

    Zoom 400% · 320 CSS pxUnder 30rem · stacked

    Label · bar · status word

    Same. The warning stays text.

  • Password strength

    0 to 4, updates while typing

    Live example

    Desktop · 768 px and up48rem · one row

    Label · bar · status word

    low 2 · high 3 · optimum 4. “Weak”.

    Smaller viewport · 480–767 px30–48rem

    Label · bar · status word below

    Sits under the password field, inside its description.

    Zoom 400% · 320 CSS pxUnder 30rem · stacked

    Label · bar · status word

    Same; the word is what counts at this size.

  • Coffee intensity

    Custom squares, no zones

    Live example

    Desktop · 768 px and up48rem · one row

    Label · squares (aria-hidden) · native meter at opacity 0

    min 0 · max 10 · value 7. “7 out of 10”. No status: no zones.

    Smaller viewport · 480–767 px30–48rem

    Label · squares

    Squares shrink before they overflow.

    Zoom 400% · 320 CSS pxUnder 30rem · stacked

    Label · squares · value text

    Value text “7 / 10” always visible next to the squares.

  • Accessibility score

    Higher is better

    Live example

    Desktop · 768 px and up48rem · one row

    Label · bar · value text · status word

    low 50 · high 90 · optimum 100. “92 out of 100, good”.

    Smaller viewport · 480–767 px30–48rem

    Label · bar · status word below

    Same.

    Zoom 400% · 320 CSS pxUnder 30rem · stacked

    Label · bar · status word

    Same.

  • Room humidity

    Middle is best

    Live example

    Desktop · 768 px and up48rem · one row

    Label · bar · value text · status word

    low 30 · high 60 · optimum 45. “45%, comfortable”.

    Smaller viewport · 480–767 px30–48rem

    Label · bar · status word below

    Same.

    Zoom 400% · 320 CSS pxUnder 30rem · stacked

    Label · bar · status word

    Same.

Say where the value is

The browser uses low, high and optimum to paint a colour, and nothing else. The zone is never exposed to assistive technology, and a colour alone tells sighted users nothing if they can’t tell red from yellow. So the status is worked out in code from the same attributes and said in words, twice.

Say where the value is
CueWhereWhat it says
Words and iconNext to the label, aria-hidden because the next cue carries it“Low”, “Filling up”, “Too humid”, with a shape for each zone: check, dash, warning. It survives without colour
aria-valuetextOn the meter“20 out of 100, low”. The name, the value and where it sits, in one stop
ColourThe fillA quick extra for those who see it. Never the only cue, and words never refer to it (“in the red”)

Humidity shows why words are required: “Too dry” and “Too humid” are the same zone and the same colour, on opposite sides of the range. Key the words by region (below low, between, above high), not by colour. The yellow fill is 1.02:1 against the track, so the 2px ink edge on the end of the fill shows where it stops.

Custom designs

When the default bar is not enough, the design is hidden from assistive technology and the information stays on the native meter.

Custom designs
LayerRule
The meterOne native meter with min, max, value, a name and aria-valuetext
The designaria-hidden="true" on the squares, the star icons and the numbers inside them. focusable="false" on an svg
The overlayposition: absolute; inset: 0; opacity: 0; pointer-events: none on the meter. Never display: none or visibility: hidden
<div class="meter">
  <label for="intensity">Intensity</label>
  <div class="meter-scale">
    <div class="meter-marks" aria-hidden="true">
      <span class="meter-mark" data-on="true"></span> <!-- × 7 -->
      <span class="meter-mark"></span>                <!-- × 3 -->
    </div>
    <meter id="intensity" min="0" max="10" value="7"
           aria-valuetext="7 out of 10">7 out of 10</meter>
  </div>
  <p class="meter-value" aria-hidden="true">7 / 10</p>
</div>
.meter-scale { position: relative; }
.meter-scale > meter {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  opacity: 0;            /* not display: none, not visibility: hidden */
  pointer-events: none;
}

A visually hidden meter (.sr-only) also works, but the screen reader cursor then sits on a 1px box away from the design.

Content

Content
PartFormatExample
LabelWhat is measured“Fuel level” · “Storage”
Value textThe value, then what it is of, in words“80 out of 100” · “12.4 of 16 GB used” · “7 out of 10”
Status wordOne for each side of the range, by what it means and not by colour“Low · Medium · Good” · “Too dry · Comfortable · Too humid”
Visible valueShort, in the same unit“80 / 100” · “12.4 / 16 GB” · “15%”
Text inside meterThe fallback for browsers without it: the value text, short“80 out of 100, good”

Behavior

Behavior
EventResult
Any change of the valuevalue, aria-valuetext, the text inside the meter and the status change together
A value outside the rangeThe browser clamps it. The marks never show more than the range
No low, high or optimumThe browser’s defaults. A custom design has no zones and no status
MarksOne for each unit of the range, the first ones lit. 3.5 lights four; the value text keeps 3.5
Status word with no numberThe word is the whole value text: “Weak”

Anti-patterns

Anti-patterns
WrongWhat goes wrong
div role="meter" with aria-valuenowRebuilds in ARIA what meter already does, and the svgs are still exposed. One missing attribute and the value is gone
progress for a measurement, or meter for task progressDifferent roles, different meaning
A hidden meter and a span that says the valuedisplay: none, visibility: hidden or aria-hidden take the meter out of the tree. The span is plain text: no role, no range, and it drifts from the value
Squares or stars with no meterA screen reader reads eleven squares one by one. No role, no name, no value, no range
Colour as the only cueOnly the red fill says “low”. Screen readers hear “20”, and sighted users who can’t tell the red get nothing
Editable stars on a meterA rating the user can change is a radio group, not a meter
max left at 1value="7" with the default max of 1: the meter reads as full

Accessibility

Keyboard

Keyboard
KeyActionNative
TabSkips the meter: it is not a tab stop. No tabindexYes
Arrow keysNothing: the value is not the user’s to change. No onclick, no role="button"Yes

Screen reader

A meter is static: it shows a value, not the progress of that value, and announces nothing. A changed value is read when the user reaches the meter. The exact words differ by screen reader, browser and platform: some say a percentage, some the raw number, and the role may be spoken as meter, level indicator or progress bar. aria-valuetext makes the spoken value explicit.

Screen reader
MomentWhat is read
Reach the meterIts role, its name, aria-valuetext and the range: “Fuel level”, meter, “80 out of 100, good”
The value changesNothing. The new value is read the next time the meter is reached
The page loadsNothing

Test, don’t assume: at least VoiceOver with Safari (macOS and iOS) and NVDA with Firefox or Chrome. In each, check that:

  • The name is read.
  • The value text is read, not the raw number.
  • The decoration is silent.
  • There is one stop for each meter.

Roles and properties

Roles and properties
PropertyExposedRule
RolemeterNative. Never role="meter" on a div
Name“Fuel level”From label for. aria-labelledby when the name is in several elements, aria-label only with no visible text. Without a name it is announced as just a value
Value“80 out of 100, good”aria-valuetext whenever the bare number is not enough: units, a scale, a status. Without it the number alone is read. Never aria-valuenow
Rangemin 0 · max 100From the native attributes
Not in the treeStatus, value text, marks, starsaria-hidden="true", and focusable="false" on an svg. The visible value text is hidden because the meter already exposes the value: never hide the only copy
Always in the treeThe meterNever display: none, visibility: hidden, hidden or aria-hidden on it. Hide the decoration instead

Support

Chromium 148 and 149, WebKit 26.4. The Firefox rules follow the design and have not been run.

Support
BrowserBar partsChecked
Chromium::-webkit-meter-*Yes
WebKit (Safari)::-webkit-meter-*Yes
Firefox::-moz-meter-bar with :-moz-meter-optimum, -sub-optimum, -sub-sub-optimumNo

WCAG criteria

WCAG criteria
CriterionRequirement here
1.1.1 Non-text Content (A)The marks, the stars and the icons are decoration, aria-hidden. The meter carries the information
1.3.1 Info and Relationships (A)label for names the meter. Role, value and range are native
1.4.1 Use of Color (A)The zone is a word and a shape as well as a colour, and is in aria-valuetext
1.4.3 Contrast (Minimum) (AA)Label 18:1, value text 8.6:1, status words 6.7:1 (purple) and 10.6:1 (red)
1.4.4 Resize Text (AA)Label, value text and bar height in rem, so they grow with the user’s font size. No fixed height on the field
1.4.10 Reflow (AA)1280px at 400% is 320 CSS px: one column, label, bar, value text. No sideways scroll, no clipped value text
1.4.11 Non-text Contrast (AA)Bar border and fill edge 18:1, empty marks 5.3:1, filled marks 4.8:1, at every zoom level
1.4.12 Text Spacing (AA)With line height 1.5, letter spacing 0.12em and word spacing 0.16em, label, status and value text wrap instead of clipping
4.1.2 Name, Role, Value (A)Native meter, label for, aria-valuetext

Related

This section is still in progress.

References

This section is still in progress.