Usage meter

Show what fills an allowance and how close it is to the limit.

pnpm dlx shadcn@latest add @uiarc/usage-meter
Live · keyboard ready
Storage2.6 GB free

12.4 GB of 15 GB used

  • Quota against a fixed allowance, such as storage, seats, or API calls.
  • Billing pages that should show what takes the space and how close the plan is to full.
  • Plans that can go over the limit, where the overage should be clear without relying on color.
  • Use progress for task completion.
  • Use bar-chart to compare categories without a limit.
  • Use gauge or stat-card for a single headline metric.

Installation

Add Usage meter with the shadcn CLI, or copy the source by hand.

pnpm dlx shadcn@latest add @uiarc/usage-meter

Adds the component and its local dependencies, and installs motion, lucide-react. First time? Add the @uiarc registry to components.json, or use the full URL:

example.tsx
import { UsageMeter } from "@/registry/components/usage-meter/usage-meter"; export function StorageCard() {  return (    <UsageMeter      label="Workspace storage"      unit="GB"      limit={50}      segments={[        { id: "files", label: "Files", value: 21.4 },        { id: "media", label: "Media", value: 14.2 },        { id: "backups", label: "Backups", value: 6.8 },      ]}    />  );}

UsageMeter

A segmented bar showing what uses a fixed allowance, with a rolling total, status badge, and interactive legend.

PropTypeDefaultDescription
labelRequiredstring–What is measured, such as "Workspace storage".
segmentsRequired{ id: string; label: string; value: number }[]–Used amounts in display order. Keep ids stable so segments re-flow. Up to four read clearly.
limitRequirednumber–The plan limit, in the same unit as the segments.
unitstring""Unit shown after numbers, such as "GB".
decimalsnumber1Digits after the decimal point.
freeLabelstring"Free"Legend label for remaining space.
overLabelstring"Over limit"Legend label for the overage.
warnAtnumber0.9Share of the limit at which the badge warns that it is almost full.
ArrowLeftorArrowRightorArrowUporArrowDown
Moves between legend items (roving tab stop).
HomeorEnd
Jumps to the first or last legend item.
EnterorSpace
Pins or unpins the focused category.
Escape
Clears the pinned category.
  • The meter is a role="group" labelled by its title; the bar is role="img" with a full text summary of every segment and the status.
  • Rolling numbers are aria-hidden with screen-reader-only text alongside.
  • Status changes (near limit, over limit, growing overage) are announced in a polite live region.
  • Legend items are buttons with aria-pressed and labels like "Media, 14.2 GB".
  • Segments grow in left to right once scrolled into view, then re-flow on one spring each when values change; crossing the limit fades in a hatched overage and limit marker.
  • Digits roll like an odometer in the direction the number moved; the status badge springs to its new width.
  • Reduced motion jumps values and swaps text with short fades.
  • The legend is an auto-fit grid of 108px minimum columns, so it wraps to fewer columns on narrow cards.
  • Hovering the bar highlights a category on mouse; on touch a tap pins it instead.
  • The caption ellipsizes on one line, so long labels do not push the layout.
  • Segments animate in once via useInView at 40% visibility, then re-flow on springs when values change.
  • A ResizeObserver tracks the bar width; up to four segments read clearly.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

  • Use for quota against a fixed allowance: storage, seats, API calls. Use progress for task completion and bar-chart for comparing categories without a limit.
  • Keep segment ids stable across renders so updates animate instead of remounting.

The full library index for assistants is at /llms.txt.