Usage Meter
Progress meter for storage, seats, and rate limits with thresholds, segmented breakdown, and overage tracking.
Team plan
Resets on December 1
- Images4.1 GB
- Video3.1 GB
- Documents1.2 GB
Keyboard
- Tab
- Focus the meter to read its value and status
On this page
Installation
The CLI also installs the npm packages and registry items it builds on, and reads the style in your components.json to pick the Base UI or Radix build.
Usage
"use client"
import { UsageMeter } from "@/components/ui/usage-meter"
export function StorageUsage() {
return (
<UsageMeter
label="Cloud Storage"
description="Allocated quota across your team"
value={7.2}
max={10}
unit="GB"
warningAt={0.8}
/>
)
}Examples
Segmented breakdown
Stack multiple category segments with an automatic legend, shared palette, and category proportions.
- PostgreSQL4.8 GB
- Redis Cache1.5 GB
- Blob Storage2.1 GB
Custom thresholds
Configure warning and danger thresholds using ratios or absolute numbers for quota management.
Overage tracking
Visualizes resource usage that exceeds 100% capacity without clipping, displaying overage badges and boundary markers.
- Production Assets6.8 GB
- Staging Assets3.4 GB
- Build Artifacts2.3 GB
API reference
UsageMeter
Progress meter for storage, seats, rate limits and quota tracking with thresholds, segmented categories and overage support.
| Prop | Type | Default |
|---|---|---|
valuenumberCurrent numeric usage value in single-value mode. | number | |
maxnumberDefault100Maximum capacity or quota limit. | number | 100 |
minnumberDefault0Minimum value. | number | 0 |
unitstringUnit label appended to values, e.g. 'GB', 'seats', 'calls', '%'. | string | |
warningAtnumberDefault0.8Threshold (ratio 0-1 or absolute number) where warning state is triggered. | number | 0.8 |
dangerAtnumberDefault1.0Threshold (ratio 0-1 or absolute number) where danger or overage state is triggered. | number | 1.0 |
segmentsUsageMeterSegment[]Array of category segments for stacked breakdown. | UsageMeterSegment[] | |
labelReactNodePrimary header label displayed above the meter. | ReactNode | |
descriptionReactNodeSecondary helper text displayed below the label. | ReactNode | |
showValuebooleanDefaulttrueShows current and maximum formatted values. | boolean | true |
showLegendbooleanDefaulttrue when segments providedDisplays the segment legend below the meter track. | boolean | true when segments provided |
showStatusBadgebooleanDefaulttrueDisplays warning or overage badges. | boolean | true |
size"sm" | "md" | "lg"Default"md"Height size variant of the meter track. | "sm" | "md" | "lg" | "md" |
localestringDefault"en-US"Locale for number formatting. | string | "en-US" |
decimalsnumberExplicit decimal places for formatted numbers. | number | |
formatOptionsIntl.NumberFormatOptionsCustom Intl.NumberFormat formatting options. | Intl.NumberFormatOptions | |
renderValue(value: number, max: number, percentage: number) => ReactNodeCustom value formatter function. | (value: number, max: number, percentage: number) => ReactNode |
Other props go to the <div>.
UsageMeterLegend
List of colored category segments with labels and formatted amounts.
| Prop | Type | Default |
|---|---|---|
segmentsRequiredCalculatedSegment[]Calculated segments to display in the legend. | CalculatedSegment[] | |
unitstringUnit label appended to values. | string | |
localestringDefault"en-US"Locale for number formatting. | string | "en-US" |
decimalsnumberExplicit decimal places for formatted numbers. | number | |
formatOptionsIntl.NumberFormatOptionsCustom Intl.NumberFormat formatting options. | Intl.NumberFormatOptions |
Other props go to the <ul>.
usage-meter-utils
resolveThreshold(threshold: number | undefined, max: number, defaultRatio: number, min?: number): number; calculateMeterStatus(options: MeterStatusOptions): UsageMeterStatus; calculatePercentage(value: number, max: number, decimals?: number, min?: number): number; calculateSegments(segments: readonly UsageMeterSegment[], max: number, colors?: readonly string[], min?: number): CalculatedSegment[]; formatUsageValue(value: number, options?: FormatUsageOptions): string; getUsageAriaValueText(options: AriaValueTextOptions): stringPure utility functions for status determination, segment calculation, and Intl formatting. Import from @/lib/usage-meter-utils.