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-meterThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
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.
oxyn add usage-meterUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Ok
Under the warning line.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Almost
Past 90 %: Almost full.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Over
Past the limit: hatched overage and a limit marker.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
UsageMeter
| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | String | — | Heading. |
sharesrequired | Vec<Share> | — | Categories. |
limitrequired | f64 | — | Allowance. |
unit | String | Default::default() | Unit after numbers ("GB"). |
decimals | usize | 1 | Decimals. |
free_label | String | "Free" | Legend label for remaining space. |
over_label | String | "Over limit" | Legend label for the overage. |
warn_at | f64 | 0.9 | Share of the limit at which the badge warns. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| ←or→or↑or↓ | Move between legend items |
| HomeorEnd | First / last item |
| EnterorSpace | Pin or unpin a category |
| Escape | Clear 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
UsageMeterfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
UsageMeterElinoxyn_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.