Quota Banner
A banner or one compact line: how many messages or credits are left, a meter, a live "Resets in 3h 12m", and the upgrade button. The tone follows the share used, and the words change with it.
The decision inside it
It says what is left, not what is used
"8 messages left" is the number someone plans with. At zero it says so plainly and when they come back, and it never disables anything itself: locking the composer is your app's decision.
When to use it
Use Quota Banner for a message or credit allowance: what is left, a meter, a live reset countdown and an upgrade button. It does not disable your composer; do that yourself when nothing is left. For metered usage with overage cost, use Usage & Overage.
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 Layro's Quota Banner for this.
Install it: npx shadcn@latest add @layro/quota-banner
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/quota-banner.
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. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.
Usage
import { QuotaBanner } from "@/components/ui/quota-banner";
export function MessageQuota({ used, resetsAt, upgrade }: { used: number; resetsAt: Date; upgrade: () => void }) {
return <QuotaBanner used={used} limit={50} unit="messages" resetsAt={resetsAt} onUpgrade={upgrade} />;
}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.
| Prop | Type | Notes |
|---|---|---|
usedrequired | number | How much has been used this period. |
limitrequired | number | The allowance for the period. |
unit | string | What is counted, plural. Default "messages". |
unitSingular | string | The unit for exactly one, when it is not `unit` without its s ("query" for "queries"). |
resetsAt | Date | string | When the allowance resets. Drives the live countdown. |
variant | "banner" | "compact" | "banner" is a full-width bar with a meter; "compact" is one line for a composer footer. Default banner. |
tone | "auto" | "info" | "warning" | "danger" | "auto" picks from the share used. Default auto. |
onUpgrade | () => void | Shows the upgrade button. |
upgradeLabel | string | The upgrade button's words. Default "Upgrade". |
dismissible | boolean | Adds a dismiss button. |
onDismiss | () => void | Called when dismissed. The banner hides itself either way. |
Dependencies
npm packages
clsxlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themeStates
All of them are drawn by the component. None is left for you to design.
- Plenty left
- Running low
- Used up
- Reset
- Compact
Accessibility
- 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
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.