# UsageMeter

How much context or money has been used, with what the number means. A percentage shows only when there’s a known limit.

- **Use it for**: Context or cost usage with what the number means.
- **Not for**: Calibration scores. Try [ConfidenceNote](https://unseenui.com/components/confidence-note/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { UsageMeter } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<UsageMeter variant="inline" label="Context" value={measured({ used: 12400, limit: 32000 })} />
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `currency` | `string` | ISO 4217 code for the currency unit. |
| `label` (required) | `string` | What is being measured, such as "Context" or "Cost". |
| `locale` | `string` |  |
| `unit` | `"tokens" \| "currency" \| "count"` |  |
| `value` (required) | `Measurement<Usage>` |  |
| `variant` | `"detail" \| "inline" \| "badge"` |  |
| `warnAt` | `number` | Fraction of the limit from which the meter reads as a warning. |

## Keyboard

Tab reaches controls; Enter or Space activates buttons. Accordions use arrow keys, Home and End. Select menus support arrows and typeahead; Escape closes menus and dialogs and restores focus.

## Works with

[AgentSteps](https://unseenui.com/components/agent-steps/), [ToolCall](https://unseenui.com/components/tool-call/), [ToolResult](https://unseenui.com/components/tool-result/), [ToolGroup](https://unseenui.com/components/tool-group/), [ExecutionTimeline](https://unseenui.com/components/execution-timeline/), [RunInspector](https://unseenui.com/components/run-inspector/), [Plan](https://unseenui.com/components/plan/), [WorkSummary](https://unseenui.com/components/work-summary/), [ChainOfThought](https://unseenui.com/components/chain-of-thought/), [WorkflowGraph](https://unseenui.com/components/workflow-graph/), [ConnectionStatus](https://unseenui.com/components/connection-status/), [RunBoard](https://unseenui.com/components/run-board/)

Page: https://unseenui.com/components/usage-meter/
