Usage Meter
Server ComponentLinear or circular quota / billing usage indicator with severity tones.
Import
tsx
import { UsageMeter, UsageMeterLinear, UsageMeterCircular } from "@cronus-ui/ui";
bash
npx cronus-ui add usage-meter
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component UsageMeterDefault layout:inline style:usage-meter {
value:40
aria-label:"Token usage"
label "Tokens"
}
page "/audit/usage-meter/default" type:custom {
use UsageMeterDefault
}
API Reference
Generated from the component's exported types.
UsageMeterProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "children">
| Prop | Type | Default | Description |
|---|---|---|---|
value* | number | — | Current usage. |
max* | number | — | The quota / limit the usage is measured against. |
label | ReactNode | — | Optional label shown beside (linear) or below (circular) the meter. |
unit | string | — | Unit suffix appended to the value readout, e.g. "tokens". |
variant | UsageMeterVariant | "linear" | Layout: a horizontal bar or an SVG ring. |
tone | UsageMeterTone | "auto" | Color. `auto` derives severity from the usage ratio; others are explicit. |
formatValue | (value: number, max: number) => string | — | Override the `value / max` readout. |
showValue | boolean | true | Whether to render the textual value/percentage readout. |
size | number | 96 | Diameter of the ring in px (circular variant only). |
className | string | — | Additional class names merged onto the root. |
id | string | — | DOM id of the root element. |
UsageMeterLinearProps
Extends Omit<UsageMeterProps, "variant">
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | Current usage. |
max | number | — | Upper bound of the meter. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |
UsageMeterCircularProps
Extends Omit<UsageMeterProps, "variant">
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | Current usage. |
max | number | — | Upper bound of the meter. |
children | ReactNode | — | Contents of the component. |
className | string | — | Additional class names merged onto the root. |