Billing Tier Usage Limits
A usage limits block that lists several plan resources, like API calls, team members, or storage, each with a progress bar comparing current usage to the tier limit. Bars switch to amber past a warning threshold and red past a critical one, and any resource with a null limit renders as unlimited instead of a bar. Built for account settings and dashboards where a user needs to see how close they are to outgrowing their plan.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-tier-usage-limits.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing141.tsx instead.
Usage
The file also exports billing141Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Billing141, billing141Demo } from "@/components/blocks/billing/billing141"; export default function Page() { return <Billing141 {...billing141Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Plan usage" | Heading shown above the resource list. |
| description | string | none | Optional supporting text under the heading. |
| planName | string | none | Optional plan name shown as a badge in the header. |
| resources | UsageResource[] | none | Resources rendered in the order given, each with a used amount and a limit or null for unlimited. |
| asOfLabel | string | none | Timestamp label shown in the footer, e.g. "10:32 AM today". |
| upgradeHref | string | none | Link target for the upgrade button; the button only renders when this or asOfLabel is set. |
| upgradeLabel | string | "Upgrade plan" | Label on the upgrade button. |
| warningThreshold | number | 80 | Usage percentage at or above which a bar turns amber and a warning note appears. |
| criticalThreshold | number | 95 | Usage percentage at or above which a bar turns red and a limit-reached note appears. |
| className | string | none | Extra classes for the outer container. |
Types
interface UsageResource { id: string; label: string; used: number; limit: number | null; // null = unlimited unit?: string; }
Behavior notes
- Each resource's percentage is computed as used divided by limit, capped at 100, and used to both set the bar width and pick its color via warningThreshold and criticalThreshold.
- A resource with limit set to null skips the progress bar entirely and shows an Unlimited badge with an infinity icon instead.
- Crossing criticalThreshold replaces the warning note with a stronger "limit reached" message in the destructive color.
- The footer with asOfLabel and the upgrade button only renders when at least one of those two props is passed.
- All values are read from props on every render; there's no polling or live refresh built in, so the caller re-renders it with fresh usage numbers.
Frequently asked questions
More Billing Blocks
View all →Billing Invoice List
Invoice history table with status badges, formatted amounts, and a per-row download link, built with shadcn/ui and Tailwind CSS.
Billing Failed Payment Alert
High-contrast failed-payment alert with a message, a retry button, and an optional update-payment-method button, built with shadcn/ui and Tailwind CSS.
Billing Credit Balance
Compact credit balance card with a large total, an optional purchased-versus-promotional breakdown, a low-balance notice, and a top-up button.
Billing Payment Methods
A saved payment method list for React and Next.js with brand icons, a default badge, near-expiry warnings, and remove/set-default actions per row.
Billing Add Card
A card entry form for React and Next.js with auto-formatted fields, internal brand detection, and per-field validation feedback built with shadcn/ui and Tailwind CSS.
Billing Coupon Code
An inline promo code input for React and Next.js with a simulated loading state, an applied summary showing the discount amount, and an invalid-code message.