Skip to content
Thrum

Usage meter

A quota bar: how much of a limit is used, with a mark at each threshold and a word when usage gets close. Use it on billing and settings pages for storage, seats or requests. For a reading with no thresholds, use the ring meter.

Install

npx shadcn@latest add @thrum-pro/usage-meter

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Props

PropTypeDefaultDescription
usednumberRequiredHow much is used, in the same unit as limit.
limitnumberRequiredThe quota. Usage above it fills the bar and reads “Over limit”.
labelstringRequiredWhat is being used. Shown above the bar and used as the name of the meter.
formatIntl.NumberFormatOptionsDefault compactHow both numbers are written, for example { style: "unit", unit: "gigabyte" }.
localestringDefault "en-US"Locale for number formatting.
warnAtnumberDefault 0.8Share of the limit where the bar turns to the warning colour and reads “Near limit”.
alarmAtnumberDefault 0.95Share of the limit where the bar turns to the alarm colour and reads “At limit”.
soundbooleanDefault truePlay a chirp when usage crosses a threshold upwards, if the visitor has sound on.
classNamestring–Sets the width. The meter fills the width it is given.

Motion and sound

Motion

  • First draw: when the meter scrolls into view, the fill grows from the left in about 400 ms while the number appears at its reading.
  • A new value moves the fill and the number from where they are, with no overshoot.
  • The colour and the word change at once when usage passes a threshold. They are steps, so they do not fade.
  • Reduced motion: the fill and the number appear at their value and change instantly.

Sound

  • A two-tone chirp when a change takes usage up past a threshold or past the limit. One chirp per change, none on the way down and none when the meter first appears.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • Exposed as a meter named by the label, with a spoken value such as “9.6 GB of 10 GB, at limit”.
  • Each state is a lamp and a word, not only a colour: “Near limit” from the first threshold, “At limit” from the second, “Over limit” above the limit.
  • The threshold marks sit under the bar, so the fill never hides them.
  • It is not a live region. If a state change needs announcing, say it in your own status message.
  • The state words are in English and fixed in this version.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/usage-meter.tsx
Packages
motion
Brings along
Chart foundationsMotion tokensSound engineAnimated number

Changelog

  1. 1.0.1 · 2026-12-03Corners follow the project's --radius, down to square.
  2. 1.0.0 · 2026-12-02First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor