AI-16AIUpdated, November 16, 2026
AI Context Meter
How full the context window is, as a ring in the prompt footer that opens a breakdown by source and compacts when it fills.
PROSlash Command Menu and more like it are in Kokonut UI Pro
Installation
AI Context Meter is a free, open-source React component in the Kokonut UI AI collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/ai-context-meter.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/ai-context-meterOr add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/ai-context-meter.tsx.
npm install motionUsage
import AIContextMeter from "@/components/kokonutui/ai-context-meter";
export default function Example() {
return <AIContextMeter />;
}Props
segmentsContextSegment[]What fills the context window, in the order to draw it. When omitted, a demo conversation grows on its own.
limitnumberDefault 200_000The model's context window, in tokens.
compactAtnumberDefault 0.8Share of the window at which the conversation compacts, 0 to 1.
onCompact() => voidShows a Compact button in the panel. The demo compacts by itself.
modelstringDefault "Claude Opus"Shown beside the meter, like the footer of a prompt box.
defaultOpenbooleanDefault falseclassNamestringExtra classes for the root element.
ContextSegment
idrequiredstringlabelrequiredstringtokensrequirednumbercolorstringA Tailwind background class for the segment, such as bg-sky-500.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
motion | ^12.23.25 | npm, installed by the CLI |
cn from lib/utils.ts | shadcn init | |
| React | 19 | Your app |
| Tailwind CSS | 4 | Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.

