React Quota & Usage Meter

A usage page answers one question — "am I about to be charged for overage" — and a plain progress bar can't. 62% used looks fine until you notice you're 11 days into the month. This meter projects the current run-rate to the end of the period, so the bar tells you where you're heading, not just where you are.

Usage & quota

Billing period · 1–31 Jul

19 days left
API requests4.8M / 10M
Projected overageProjected 13M · 3M over
Compute hours940 / 2K hr
Projected overageProjected 2.5K hr · 541 hr over (~$974)
Object storage240 / 1K GB
On trackProjected 649 GB
Active seats41 / 50
Within limit9 remaining
Projected overage this period~$974

Installation

npx shadcn@latest add "https://kelvinui.com/registry/quota-meter.json"

Props

PropTypeDescription
metersQuotaMeter[]{ id, label, used, limit, unit?, unitOveragePrice?, mode? }
periodElapsednumberFraction of the billing period elapsed, 0–1
periodLabelstringHeading for the period
periodRemainingLabelstringPre-formatted, e.g. "19 days left"
currencystringSymbol for overage estimates (default "$")

The projection is the whole point

Each cumulative meter divides current usage by periodElapsed to get an end-of-period estimate — 4.8M requests at 37% of the month projects to 13M — and draws it as a striped extension beyond the solid "used" bar, up to a limit tick. Green means the run-rate lands under the limit; amber means it doesn't, even while today's number is comfortably below the line. Where an unitOveragePrice is set, the projected overage is priced, and the per-meter estimates roll up into a single "projected overage this period" figure in the footer — the number the account owner actually wants.

This is a linear run-rate, which is the right default and an honest simplification: it assumes the rest of the period looks like the start. For spiky or seasonal usage, feed a smarter forecast straight into a meter as its projection — the bar and the copy don't care how the number was produced.

Not everything can be projected

mode: "instant" marks a meter that is a point-in-time count rather than an accrual — active seats, live connections, provisioned nodes. Projecting a headcount by elapsed time is a fiction (41 seats at 37% of the month is not "heading for 111 seats"), so instant meters skip the run-rate entirely and show current headroom — "9 remaining" — with a near-limit warning at 90%. Keeping the two kinds visibly distinct is what stops the projection from lying: a meter is only extrapolated when extrapolating it means something.

New components every week

Get the week's new Kelvin UI components and templates in one short email. No spam, unsubscribe anytime.