Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Context Meter

ProNew

Token and context-window usage meter with animated stacked segments, hover breakdown, warning states, and Compact action.

Installation

pnpm dlx shadcn@latest add @viewport/context-meter

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
segments*ContextSegment[]

Breakdown of tokens currently occupying the window.

—
limit*number

Total token limit of the model context window.

—
modelstring

Optional model name shown in the header.

"200k context"
onCompact() => void

Called when the user triggers context compaction.

—
classNamestring—

Accessibility

  • Exposes role=meter with numeric min, max, and current token count.
  • Uses tabular numerals so live token counts never shift the layout.
  • Segment resizing snaps immediately under reduced motion.