Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Usage Meters Billing Block for React

Usage meters for an app's settings: one row per quota with its count, a bar that turns to a warning tone at 80% and an over-limit tone past 100%, and a plain line on what happens next.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Show customers where they stand against every quota, inside your app, with this usage meters section for React with Base UI. A hairline frame with a plus mark on each corner holds a summary band and one row per quota (log volume, retention storage, seats and API requests). The summary band lays out plan, period and reset date as a Data List, beside a Shine Button to upgrade, the only colored control, and an outline "Export usage" Button. Each row gives the count against the limit, a Progress bar and a line on what happens next. A bar keeps your foreground color until 80%, where it takes the warning tone and a "Nearly full" Badge; past 100% it fills in the destructive tone and the badge reads "Over limit". A tick marks 80% on every bar, and a footer note says when the limits reset. Each row's top rule is drawn with Guides, with a plus where it meets the frame. It's a server component with a CSS entrance only. For SaaS billing settings, usage pages and admin consoles.

FAQ

How do I fill the meters from my own metering?

Everything comes from two constants at the top of the file. ACCOUNT holds the plan's name and three ISO dates: the first and last day of the period and the day it resets. METERS lists each quota's label, used, limit, the unit written after a count ("GB", or empty for plain counts), the noun a screen reader hears, and the next line that says what happens at the limit. Replace them with your own usage data, and pass them in as props if the page fetches them.

How does a meter pick its tone?

toneOf compares used with limit. Below 80% the bar is your foreground color and there is no badge. From 80% up to the limit the bar takes the warning tone and the row gets a "Nearly full" badge. Over the limit the bar fills completely in the destructive tone and the badge says "Over limit"; the count still shows the real number, so 1.08M of 1M reads as it is. Change WARN_AT to move the threshold, and the tick on each bar sits at 80%, so move it with start-[80%] too.

Why does every row say what happens next?

A bar alone doesn't tell anyone whether to worry. The line under each one says what the limit does in your product: new logs are dropped after a day, the oldest logs roll off, extra seats cost a set price, requests are rate limited. It is plain text on the page, not a tooltip, so a phone, a keyboard and a screen reader all get it. Keep your own lines true to what your product does at each limit.

What does a screen reader hear?

The section is headed by an h2 and each quota by an h3. A row reads as its label, any state badge, then its count and limit, for example "API requests, Over limit, 1.08M of 1M requests, 108%", then the line on what happens next. The bars only repeat what the numbers say, so they're hidden from assistive technology rather than announced twice. Dates sit in time elements and are written in UTC, so the reset day is the same on the server and in every time zone.

Where do the buttons go?

They're links. "Upgrade plan" is the one primary action and comes first, so it's the first stop for the keyboard and the top button on a phone; point it at your plan picker, and "Export usage" at your usage export. Each is a Button or Shine Button with render set to an a element and nativeButton={false}.

How does it look on a phone?

The heading starts near the top and the upgrade button comes within the first screen. The two buttons stack at full width, and each row folds into one column: the label and count, then the bar and its line. Nothing scrolls sideways.

  • Pro

    Current Plan Billing

    Plan and usage

    The account's current plan in app settings: plan, price, renewal date and card, a change-plan action, every quota's usage this period on shared hairlines, and the next invoice.

  • Pro

    Usage Alerts Billing

    Plan and usage

    Usage alert settings: percentage thresholds as switches with number inputs, recipients as email chips, and a choice between email and a webhook, with a save that checks them.

  • Pro

    Limit Reached Billing

    Upsell and retention

    The upgrade prompt shown where someone hits a plan limit: what was blocked, the limit reached against the next plan's, a two-column comparison and Upgrade or Remind me later.

  • Pro

    Headroom Bars Pricing

    Usage and credits

    One card of capacity bars for an uptime monitor: each grows from a Free limit to Pro's, with a chip counting how many times more Pro gives, and the upgrade button at the card's top right.

  • Pro

    A monthly estimate for Light, Standard and Heavy usage of a speech-to-text API: choosing a profile rolls the total, resizes a tall stacked bar of where the bill comes from and updates each cost line.

  • Pro

    Seats on a team plan: members with a role each (viewers are free), a stepper for the seats you pay for, and the monthly and prorated cost worked out before you save.