Usage & Overage
Usage projected from today's run rate, with the day you cross and what it costs.
- Category
- Billing
- Access
- Free with an account
- Source
- 337 lines · one file
- Added
- 28 Sept 2026
The decision inside it
The meter goes past the limit
A bar that clamps at 100% hides the only number that matters in the week it matters. The scale is whichever is larger, the allowance or where this ends, so an overage is drawn as an overage.
When to use it
Use Usage & Overage for metered usage: used against what's included, where the period is heading, the day it crosses the limit and what the overage will cost (rates in cents per unit block).
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Usage & Overage for this.
Install it: npx shadcn@latest add @liro/usage-meter
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/usage-meter.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { UsageMeter } from "@/components/ui/usage-meter";
export function ApiUsage() {
return (
<UsageMeter
title="API calls"
unit="calls"
included={100_000}
used={72_400}
day={18}
daysInPeriod={30}
periodEnd="14 Nov"
overage={{ per: 1000, price: 20 }}
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
unit | string | Yes | What is being counted, plural: "API calls", "build minutes", "GB stored". |
included | number | Yes | – |
used | number | Yes | – |
day | number | Yes | Where today is in the period, for the run rate. |
daysInPeriod | number | Yes | – |
periodLabel | string | No | Display strings. The component formats no dates. |
periodEnd | string | Yes | – |
crossesOn | string | No | The day the allowance runs out at the current rate, if it will — computed by the buyer's app, which owns the calendar. Drawn on the meter. |
overage | { per: number; price: Cents } | No | The overage rate: `{ per: 1000, price: 20 }` is $0.20 per 1,000. |
currency | string | No | – |
locale | string | No | – |
title | string | No | – |
action | { label: string; onClick: () => void } | No | Optional quiet action, e.g. "Compare plans". |
look | Look | No | Layered sets it in a tray, the heading above the card and the status in the strip below. Flat is one card. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themeAccessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances