FORMA Docs

Usage meter

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

import { UsageMeter } from "@/forma/arc/usage-meter/usage-meter";
Base

In FORMA

  • Liegt in kit/arc/usage-meter und ist über @/forma/arc/usage-meter/usage-meter erreichbar.
  • Farbe, Ecken, Höhen, Abstände, Tiefe, Schrift und Tempo kommen aus der Richtung (core/arc-bridge.ts); Arc behält Verhalten, Tastatur und Federn.

When to use

  • 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.

When not to use

  • Use progress for task completion.
  • Use bar-chart to compare categories without a limit.
  • Use gauge or stat-card for a single headline metric.

Usage

import { UsageMeter } from "@/forma/arc/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

  • 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".

Motion

  • 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.

Responsive behavior

  • 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.

Performance

  • 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

  • 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.

Also in progress

  • Skeleton: Reserve space while content is still loading.
  • Stepper: Show where a person is in a multi-step flow and what is done.
  • Countdown: A launch countdown with rolling digits that morphs into a live state at zero.
  • Onboarding checklist: Guide a new workspace through setup, one step at a time.

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://uiarc.dev/llms.txt

Komponente und Text: Arc UI (MIT, uiarc.dev), angepasst für FORMA.