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-meterThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
used | number | Required | How much is used, in the same unit as limit. |
limit | number | Required | The quota. Usage above it fills the bar and reads “Over limit”. |
label | string | Required | What is being used. Shown above the bar and used as the name of the meter. |
format | Intl.NumberFormatOptions | Default compact | How both numbers are written, for example { style: "unit", unit: "gigabyte" }. |
locale | string | Default "en-US" | Locale for number formatting. |
warnAt | number | Default 0.8 | Share of the limit where the bar turns to the warning colour and reads “Near limit”. |
alarmAt | number | Default 0.95 | Share of the limit where the bar turns to the alarm colour and reads “At limit”. |
sound | boolean | Default true | Play a chirp when usage crosses a threshold upwards, if the visitor has sound on. |
className | string | – | 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
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.0.1 · 2026-12-03Corners follow the project's --radius, down to square.
- 1.0.0 · 2026-12-02First release.