UsageList
A list of usage limits, one a row: the limit's name, how much is used of it, a bar, and a short note.
How full the prompt context is and what uses the space, by segment, with a warning near the limit, Trim oldest and compaction with Undo. Compact form for a header.
How full the prompt context is. Not a usage meter. Not Progress.
Near the limit, the thread compacts: earlier messages fold into a summary, the bar shrinks to its new fill and the freed tokens show. Undo brings the old context back. Variants shows normal, warning, full and compacted.
Tokens used/ 200,000 tokens86% used
Oldest messages will be trimmed soon. Trim now to keep control.
ContextWindow is about one thread's prompt context. Plan usage is a different meter. Near limit and full are said in text and an icon, never colour alone. For a compaction, pass compaction with the count from before; once compacted, pass the new used and segments. To undo, clear compaction and put used back.
import { ContextWindow } from "agentic-ds-kit";From contracts/contextwindow.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.
| Name | Type | Required | Default | Notes |
|---|---|---|---|---|
| used | number | Yes | — | Tokens, not a percent. |
| limit | number | No | — | Without it: "limit unknown", no percentage. |
| segments | array | No | — | { id, label, tokens }[] in display order; colours in order: grey (--border-strong), teal (--chart-2), blue (--chart-1), primary (--primary), light grey (--border-faint); a sixth starts again at grey. No violet. |
| warningAt | number | No | 0.8 | — |
| compact | boolean | No | false | One line: kit Meter, used / limit, status icon. |
| label | string | No | Context window | — |
| onTrim | function | No | — | Trim oldest: outline neutral sm Button in the footer, the same in every state. |
| compaction | object | No | — | { status: "compacting" | "compacted", before, summary? }. Compacting: a shimmer status line in place of the near-limit notice (compact: spinner). Compacted: freed tokens and %, the count before, and a Collapsible "Earlier context summarized" row with the summary (card only). Clear it and restore used to undo. |
| onUndo | function | No | — | Undo, shown only when status is "compacted": ghost neutral Button before Trim; compact: icon-only Button with a Tooltip. |
| loading | boolean | No | false | — |
| error | string | No | — | — |
| onRetry | function | No | — | — |
A list of usage limits, one a row: the limit's name, how much is used of it, a bar, and a short note.
How far along or how full something is, from 0 to 100, as a bar, a ring, or a half ring, with optional red, amber, and green zones.
Task completion as a bar or circle from 0 to 100, or an indeterminate bar when the percent is not known.
Single show/hide panel.