TokenCounter

Displays token usage against a context window limit with a progress bar and formatted counts.

Context window12,400 / 128,000 tokens

import { TokenCounter } from "@aetherstack/ui"

Installation

terminal
npx aether-ui add token-counter

Import

import.tsx
import { TokenCounter } from "@aetherstack/ui"

Usage

tokencounter.tsx
<TokenCounter used={12400} max={128000} />

Props

PropTypeDefaultDescription
used*numberNumber of tokens used in the current context.
max*numberMaximum token limit of the model context window.
classNamestringAdditional CSS classes.

* Required

Accessibility

  • The progress bar uses role='progressbar' with aria-valuenow, aria-valuemin, and aria-valuemax attributes.
  • Counts are formatted with locale-aware number formatting for readability.