Usage Meter

Progress meter for storage, seats, and rate limits with thresholds, segmented breakdown, and overage tracking.

@drift-ui/usage-meterRegistry JSONOpen in v0

Team plan

Resets on December 1

Build minutes
2,140 min / 3,000 min
StorageAcross 3 projects
84% used8.4 GB / 10 GB
  • 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

usage-meter-usage.tsx
"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.

Infrastructure StorageManaged storage allocation by resource type
84% used8.4 GB / 10 GB
  • 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.

Team Seat AllocationWarning threshold triggered at 80% capacity
90% used18 seats / 20 seats
Monthly API RequestsWarning at 80,000 and danger at 95,000 of 100,000 quota
96,000 calls / 100,000 calls

Overage tracking

Visualizes resource usage that exceeds 100% capacity without clipping, displaying overage badges and boundary markers.

Single Value OverageSingle meter exceeding limit with overage badge
2.5 GB over limit12.5 GB / 10 GB
Stacked Segment OverageSegmented breakdown exceeding limit with boundary line
2.5 GB over limit12.5 GB / 10 GB
  • 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
valuenumberCurrent numeric usage value in single-value mode.
maxnumberDefault100Maximum capacity or quota limit.
minnumberDefault0Minimum value.
unitstringUnit label appended to values, e.g. 'GB', 'seats', 'calls', '%'.
warningAtnumberDefault0.8Threshold (ratio 0-1 or absolute number) where warning state is triggered.
dangerAtnumberDefault1.0Threshold (ratio 0-1 or absolute number) where danger or overage state is triggered.
segmentsUsageMeterSegment[]Array of category segments for stacked breakdown.
labelReactNodePrimary header label displayed above the meter.
descriptionReactNodeSecondary helper text displayed below the label.
showValuebooleanDefaulttrueShows current and maximum formatted values.
showLegendbooleanDefaulttrue when segments providedDisplays the segment legend below the meter track.
showStatusBadgebooleanDefaulttrueDisplays warning or overage badges.
size"sm" | "md" | "lg"Default"md"Height size variant of the meter track.
localestringDefault"en-US"Locale for number formatting.
decimalsnumberExplicit decimal places for formatted numbers.
formatOptionsIntl.NumberFormatOptionsCustom Intl.NumberFormat formatting options.
renderValue(value: number, max: number, percentage: number) => ReactNodeCustom value formatter function.

Other props go to the <div>.

UsageMeterLegend

List of colored category segments with labels and formatted amounts.

Prop
segmentsRequiredCalculatedSegment[]Calculated segments to display in the legend.
unitstringUnit label appended to values.
localestringDefault"en-US"Locale for number formatting.
decimalsnumberExplicit decimal places for formatted numbers.
formatOptionsIntl.NumberFormatOptionsCustom Intl.NumberFormat formatting options.

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): string

Pure utility functions for status determination, segment calculation, and Intl formatting. Import from @/lib/usage-meter-utils.

Source

components/ui/usage-meter.tsx