Launch priceOne payment

Context Window

The context budget as one bar split into its parts (system prompt, tools, history, retrieved chunks, tool results, the new message), with each part's tokens and share in a list underneath. Truncated parts are hatched and labelled, estimates are called estimates, and content previews stay hidden until turned on.

RAG & EvalsFree317 lines · one file

Ready for AI tools one file typed props installs by name prompt included

The decision inside it

Unknowns stay unknown

Without a model limit there is no "remaining" and no percentage of the window; the bar then compares the parts with each other and says so.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Context Window for this.
Install it: npx shadcn@latest add https://layropro.com/r/context-window
Import it from @/components/ui/context-window.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above.

API

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
contextrequiredContextWindowData—
onSegmentSelect(segment: ContextSegment | null) => void—
onCopySegment(segment: ContextSegment) => void—
showContentPreviewbooleanShow segment text when a row is opened. Default false.
onTruncationDetails(segment: ContextSegment) => voidAdds "Why was this cut?" to truncated segments.
summaryOnlybooleanThe bar and the totals only.
warnAtnumberWarn above this share of the window. Default 0.9.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-themebadgebuttonstate

Lifetime access

Every component, and everything we ship next.

  • All 112 components, source included
  • The template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.

More in RAG & Evals

All RAG & Evals components