Usage meter
A React component in Beamline's Feedback category, in the free sample.
An allowance and what fills it: one bar split by source, the room left, a warning near the limit and the overflow in its own red well past a notch at the limit.
Use it for
- Plan limits and quotas: seats, storage, requests.
Not for
Anatomy
- header (label, figure with a status glyph when warn/over; the share used from 28rem)
- bar: allowance well (m-inset meter, sources in series colours up to the limit)
- notch at the limit and overflow well (solid red), only when over
- legend (swatch, label, value; room left or overflow with glyph and words)
States
- ok
- warn (orange figure + ▲ glyph)
- over (red figure + ⓘ glyph, overflow well after the notch, 'N over' in the legend)
- a source in focus (pointed at in the bar or legend: the others fade toward the card)
Keyboard
- Not interactive (role meter); every amount is written in the legend
Motion
Segment widths ease over --pui-duration-standard when values change; nothing moves at rest. When the value changes, the change itself stays in view for a moment (_shared/delta-ghost): what was lost sits as a pale ghost under the fill, holds about 0.7 s and drains toward the new end; what was gained arrives lit and cools over about 1.3 s. The ghost spans the real before and after, never an in-between value; a run of changes the same way extends one ghost. Reduced motion: the ghost is shown still for 1.1 s, then removed. The total rolls to its new figure (SlotText). Pointing at a source in the bar or the legend fades the other sources toward the card colour at once (never through transparency) and eases back over --pui-motion-out.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | What is metered: "Storage", "Seats". |
segments | { id, label, value }[] | — | What fills the allowance, in order. |
limit / unit / decimals | number / string / number | — | |
warnAt | 0–1 | — | Share of the limit (0–1) where it turns to a warning. Default 0.9. |
freeLabel / overLabel | string | — | freeLabel: Words for what is left. Default "left". overLabel: Words for going past the limit. Default "over". |
style / ref | CSSProperties / native Ref | — | style: Inline styles on the documented visual root; no overrides by default. ref: Receives the documented native target or imperative handle; omitted by default. |
classNames | UsageMeterClassNames | — | Classes for the named visual parts; no overrides by default. |
formatOptions | Intl.NumberFormatOptions | — | Write the numbers with Intl options instead (`{ style: "currency", currency: "USD" }` gives "$7.50"); `unit`, if given, still follows. Serializable, so a server component can pass it. |
locale | string | — | The locale the numbers are written in. Defaults to the enclosing UIRoot locale. |
limit (required) | number | — | |
unit | string | — | After each number: "GB", "k". |
decimals | number | — | |
freeLabel | string | — | Words for what is left. Default "left". |
overLabel | string | — | Words for going past the limit. Default "over". |
className | string | — | Classes on the documented visual root; no override by default. |
style | CSSProperties | — | Inline styles on the documented visual root; no overrides by default. |
ref | Ref<HTMLDivElement> | — | Receives the documented native target or imperative handle; omitted by default. |
palette | "quiet" | "series" | — | How the sources are told apart: series colours (default), or quiet ink steps, darkest first, for money and other amounts where a series colour (red in Pop) would read as an alarm; the overflow keeps its tone either way. |
Built from
Used in
Import
import { UsageMeter } from "@beamline/usage-meter";
Get it
Usage meter is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Usage meter is included in the free MIT sample. Get Beamline · Connect your agent
More in Feedback
- Timer: A duration that counts down (or up) from your clock: Start, Pause, Resume, Reset and the finish reported once; the time left drawn as a bar you drag (or…
- Notification centre: Updates that wait to be read: a bell with the unread count opens All / Unread, new and earlier groups, and per item mark read or dismiss.
- Alert: A message that stays until it is dealt with: what happened, what to do, an action; danger and warning are announced; dismissing folds its height away.
- Cookie consent: Asks once which cookies a visitor allows, with Reject all and Accept all given equal weight; Customise grows the notice in place into each category with…
- Empty state: What a place will hold and the first step to fill it, instead of a blank; a compact size for panels and filtered tables.
- Spinner: A ring that spins while work runs and closes into a drawn check or cross when it ends.
- Announcement bar: A banner across the top for news and offers: messages take turns, a countdown ticks, and dismissing folds it away and can remember it.
- Progress: How much of a known task is done, or a moving bar when the length is unknown, with an optional label and value.
- Skeleton: Holds the shape of content while it loads, then crossfades into it, so nothing jumps.