ui-kit0.0

Signature

Usage meter

Quota used, with thresholds that warn.

Storage

How much of a quota is used, in words and as a bar. The fill grows in once when it mounts.

Storage

When to use

  • A plan limit or quota: storage, seats, API requests, build minutes.
  • Anything where “how close am I to the limit” matters more than the exact number.
  • Breaking one quota into categories (photos, videos, mail) with a segmented bar.

Not for: work that finishes (an upload, a setup flow) — use Progress. Not for comparing many values — use a bar chart.

Thresholds

At 75% the fill turns to the warning colour and at 90% to destructive, with a status line so colour is never the only signal. Change the points with thresholds, or pass false for none. Use up requests to see it shift.

API requests
Team seats

Segmented

Pass segments to split the fill by category. Each takes the next data-series colour and gets a legend entry; the total is their sum. Thresholds still show in the status line.

Drive storage
  • Photos3.4 GB
  • Videos2.9 GB
  • Documents1.5 GB
  • Mail0.8 GB

API

UsageMeter

PropTypeDefaultDescription
valuenumber—Amount used. Omit with segments to use their sum.
maxnumber—The quota. Required.
labelReactNode—Visible name; names the meter. Without it, pass aria-label.
unitstring—Appended to numbers: "GB" gives "7.2 GB of 10 GB".
formatValue(value: number) => string—Custom number format (replaces unit).
summaryReactNode | false—Replace or hide the "x of y" text.
thresholds{ warning?: number; destructive?: number } | false{ warning: 75, destructive: 90 }Percentages where the colour shifts.
segments{ label: string; value: number; color?: string }[]—Categories; colours default to --ui-series-1…6.
legendbooleantrue with segmentsShow the legend list.
size'sm' | 'md' | 'lg''md'Track thickness: 4 / 8 / 12px.
descriptionReactNode—Secondary text under the bar, wired with aria-describedby.
labels{ of?; warning?; destructive?; full? }—Text for i18n.
getValueText(value, max) => string—Screen-reader value. Default "7.2 GB of 10 GB (72%)" plus the status.
...propsHTMLAttributes<HTMLDivElement>—Forwarded to the root; aria-label/-labelledby/-describedby go to the meter.

Data attributes: data-tone (default | warning | destructive) and data-segmented on the root. usageMeterTone(pct, thresholds) returns the tone for your own UI.

Keyboard

KeyAction
—Not interactive; it is skipped by Tab. Links or buttons you put inside keep their own keys.

Accessibility

  • role="meter" (WAI-ARIA meter pattern) with aria-valuemin, -max, -now and a readable aria-valuetext.
  • The value text includes the status (“approaching limit”), and the status is visible text with an icon — colour is never the only signal.
  • The visual “x of y” summary is hidden from screen readers so it is not read twice; the legend is a real list.

Motion

  • On mount the fill uncovers from the start edge on the smooth spring (CSS only, so it works in Server Components).
  • Value changes glide on the smooth spring; colours cross-fade.
  • Reduced motion: the fill appears at its value with no movement.