Staaarter

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.

By Staaarter Team
Billing
Updated March 27, 2026
Docs
Live preview

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.json

Prefer 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

PropTypeDefaultDescription
headingstring"Plan usage"Heading shown above the resource list.
descriptionstringnoneOptional supporting text under the heading.
planNamestringnoneOptional plan name shown as a badge in the header.
resourcesUsageResource[]noneResources rendered in the order given, each with a used amount and a limit or null for unlimited.
asOfLabelstringnoneTimestamp label shown in the footer, e.g. "10:32 AM today".
upgradeHrefstringnoneLink target for the upgrade button; the button only renders when this or asOfLabel is set.
upgradeLabelstring"Upgrade plan"Label on the upgrade button.
warningThresholdnumber80Usage percentage at or above which a bar turns amber and a warning note appears.
criticalThresholdnumber95Usage percentage at or above which a bar turns red and a limit-reached note appears.
classNamestringnoneExtra 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