Xzero UI
Pro library

Usage meter

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

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/usage-meter
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/usage-meter

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { UsageMeter } from "@/components/xzero/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 },
      ]}
    />
  );
}

API reference

UsageMeter

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

PropTypeDefaultDescription
label (required)string–What is measured, such as "Workspace storage".
segments (required){ id: string; label: string; value: number }[]–Used amounts in display order. Keep ids stable so segments re-flow. Up to four read clearly.
limit (required)number–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.

Keyboard interactions

KeysAction
ArrowLeft / ArrowRight / ArrowUp / ArrowDownMoves between legend items (roving tab stop).
Home / EndJumps to the first or last legend item.
Enter / SpacePins or unpins the focused category.
EscapeClears the pinned category.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in progress

Guidance for AI tools

Usage meter: Show what fills an allowance and how close it is to the limit. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components