Skip to main content
UsageDashboard shows several UsageMeters in one card, one per feature. When to use
  • A “Usage” tab in your billing or account settings.
  • A dashboard card that shows the customer’s limits.
  • Several limits at once, limited and unlimited, with the meter’s colour thresholds.
UsageDashboard with API calls at 62%, seats at 90% and storage at 98%, light theme

Importing UsageDashboard

Rendering UsageDashboard

Pass one row per feature:
components/usage-card.tsx
Each row renders a labelled UsageMeter with its colour thresholds.

Data

Each row is a UsageDashboardFeature: { key, label, used, limit? }. A limit of null, or no limit, means unlimited.

Live data

usageItems(entitlements, results) joins a plan’s metered entitlements from the catalog (for the names) with usage results keyed by feature code, the used and limit of a can() result. Entitlements that are not metered, or have no result, are left out.
currentPlanMeters(entitlements, usage) builds the same rows from this period’s charges_usage instead; see CurrentPlan.

Examples

Loading, empty and error

loading shows three skeleton rows, an empty features list shows emptyMessage, and error shows the message instead of the rows.
UsageDashboard skeleton, No usage to show yet message, and an error message, light theme

Unlimited feature

A row without a limit reads “Unlimited” and its bar stays empty.

API reference

UsageDashboardFeature[]
The rows: { key, label, used, limit? }. limit null or missing means unlimited. Defaults to [].
boolean
default:false
Shows three skeleton rows.
Error | string | null
Shows the message in a role="alert" card instead of the rows. Defaults to null.
string
default:"No usage to show yet."
Shown when features is empty.
Appearance
Theme, variables and element overrides, also passed to each meter. Defaults to the provider’s. See Appearance.

States

Appearance

usageDashboard (the card), and the UsageMeter elements for each row.Style them with appearance.elements. See Elements.

UsageMeter

One meter on its own.

UsageBreakdown

Units and amounts of this period.

CurrentPlan

The plan with its meters built for you.

UsageAlert

A warning when a limit is close.