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

Context Budget

ProNew

Fit sources into a model window with a segmented meter and a live token balance.

Installation

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

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
capacity*number

Maximum tokens available in the context window.

—
layers*Layer[]

Context sources, token costs, display colors and initial inclusion.

—
onChange(ids: string[]) => void

Receives the IDs of all included sources after a change.

—

Accessibility

  • Source switches report their state. Token totals and any overage remain readable as text.