Skip to content

Usage MeterPro

What fills an allowance: segments that grow in, a hatched overage past the limit, a badge that warns when almost full, and a legend you can pin.

oxyn add usage-meter
Storage65.2 GB of 100.0 GB65% used
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • What fills an allowance.
  • Segments grow in left to right on mount, then re-flow on one spring each when values change.
  • Past the limit the bar rescales to the total used, a hatched overage fades in right of a limit marker and the legend shows the overage.
  • The badge springs between "62% used", "Almost full" (from warn_at, 0.9) and "Over limit by 2.0 GB".

When not to use

  • A launch countdown with digits that roll per unit, a compact one-line variant, hours absorbing days when days are hidden, and a live state with a pulsing dot at zero: use Countdown instead.
  • A total that moves clearly: use Animated counter instead.
  • A collapsible JSON tree with search, paging for long arrays, copy value or path, the current path under the tree and full keyboard moves: use JSON viewer instead.

Installation

Usage Meter is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add usage-meter

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Ok

Under the warning line.

Storage65.2 GB of 100.0 GB65% used
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Almost

Past 90 %: Almost full.

Storage92.2 GB of 100.0 GBAlmost full
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Over

Past the limit: hatched overage and a limit marker.

Storage113.1 GB of 100.0 GBOver limit by 13.1 GB
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

UsageMeter

PropTypeDefaultDescription
titlerequiredString—Heading.
sharesrequiredVec<Share>—Categories.
limitrequiredf64—Allowance.
unitStringDefault::default()Unit after numbers ("GB").
decimalsusize1Decimals.
free_labelString"Free"Legend label for remaining space.
over_labelString"Over limit"Legend label for the overage.
warn_atf640.9Share of the limit at which the badge warns.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
←or→or↑or↓Move between legend items
HomeorEndFirst / last item
EnterorSpacePin or unpin a category
EscapeClear the pin

Accessibility

  • The bar is role=img with the totals and the badge in its label.
  • The legend is a roving tab stop with aria-pressed pins.
From the spec
  • The bar is role=img with totals and badge; legend items are toggle buttons with aria-pressed.

Motion & interaction

Timing
  • Grow-in 600 ms with 70 ms stagger; re-flow 500 ms spring; badge 220 ms.
  • Reduced motion jumps values and swaps text.

Responsive behaviour

  • The legend wraps.
Edge cases (spec)
  • The legend wraps.

Notes for AI

  • Import UsageMeter from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: UsageMeterEl in oxyn_gpui.
  • Props to set first: title, shares, limit.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI