Skip to main content
  1. Docs
  2. Components
  3. Feedback

Meter

A measurement within a range: storage used, a quota spent. It looks like Progress; it isn't a task.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<div role="meter">Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

meter.tsx
// From the package: a build keeps only what it uses.
import { Meter } from "@qeetrix/react";

// Or from its own path.
import { Meter } from "@qeetrix/react/progress";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
valuenumberrequiredThe measurement, from min to max.
min · maxnumber0 · 100The range.
targetnumber—A goal on the range: a tick on the track, in the read-out too. It mirrors in right to left.
labelReactNode—The visible label; without one, an aria-label.
showValuebooleanfalseThe formatted value at the header's end.
formatIntl.NumberFormatOptionsa percentageHow the value is written and read: { style: "unit", unit: "gigabyte" }.
tone"brand" | "neutral" | "info" | "success" | "warning" | "danger""brand"neutral or info for a plain amount; success, warning or danger for how it stands.
locale · messagesstring · objectthe provider'sFormats the value; the read-out with a target.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
meter<div role="meter">aria-valuenow, aria-valuetext; data-tone.
meter-header<div>The label and the value.
meter-track<div>The track.
meter-indicator<div>The bar.
meter-target<span>target's tick, aria-hidden.

04

Near a limit

Turn the tone with the value, and put the way out beside it.

plan-usage.tsx
const tone = used / limit >= 0.95 ? "danger" : used / limit >= 0.8 ? "warning" : "brand";

<Meter label="SMS credits used" showValue value={used} max={limit} tone={tone} />
Next — MeterAccessibility