Skip to content
Back

Context window (grid)Pro

The context window as 200 cells grouped by category with a threshold row: send, attach and compact show exactly how much still fits, crossing the threshold compacts on its own, and switching models re-scales every cell.

oxyn add context-grid
Context window
560K of 1M · 56.0%376K free before the reply reserve
System prompt12K
Tools38K
Files90K
Messages420K
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • An AI context window as 200 cells in 20 columns.
  • Items (GridItem { cat, label, tokens }) are grouped by category in fill order: system prompt, tools, files, summary, messages; the reply reserve fills the tail as dashed cells.
  • A dashed threshold row marks where compaction starts (threshold, 0.8).
  • Send message and Attach file add the next turn or file; crossing the threshold compacts on its own: messages fold into a summary (about 6 %, 4K–24K tokens, summarize) placed after the files, and the status line reports folded count, summary size and before → after.

When not to use

  • Prompt composer with model picker, voice input, app connections and approval request: use Chat Composer instead.
  • The model menu of an AI chat: use Model Picker instead.
  • The prompt box for an agent, in six layouts: use Composer instead.

Installation

Context window (grid) is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add context-grid

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Default

Send messages until it compacts on its own.

Context window
560K of 1M · 56.0%376K free before the reply reserve
System prompt12K
Tools38K
Files90K
Messages420K
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Near

Close to the threshold.

Context window
770K of 1M · 77.0%166K free before the reply reserve
System prompt12K
Tools38K
Files90K
Messages630K
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Early

A low threshold.

Context window
308K of 1M · 30.8%628K free before the reply reserve
System prompt12K
Tools38K
Files90K
Messages168K
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

ContextWindowGrid

PropTypeDefaultDescription
modelsrequiredVec<CtxModel>—Models to switch between.
itemsrequiredVec<GridItem>—What is in the window.
thresholdf640.8Compaction threshold.
turnsVec<(String, u64)>Default::default()Turns that Send message adds, in order.
filesVec<(String, u64)>Default::default()Files that Attach file adds, in order.
cellsusize200Number of cells.
nowrequiredClockMs—Shared clock (the model menu's type-ahead).
on_compactEventHandler<(usize, u64, u64, u64, bool)>—After each compaction: folded, summary, before, after, automatic.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabModel menu, Send message, Attach file, Compact now
EnterorSpaceOpen the menu or run an action
↑or↓orEnterChoose a model
EscapeClose the menu

Accessibility

  • The grid is role=img with totals and the threshold; status lines are role=status.
  • Reduced motion changes cells and numbers at once.
From the spec
  • The grid is role=img with totals and the threshold; the status line is role=status.

Motion & interaction

Timing
  • Wave 6 ms per cell from the origin, max 360 ms; numbers roll 260 ms; status crossfades 200 ms.
  • Reduced motion changes cells and numbers at once.

Responsive behaviour

  • Twenty columns that scale with the card.
Edge cases (spec)
  • Twenty columns scale with the card.

Notes for AI

  • Import ContextWindowGrid from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: ContextGridEl in oxyn_gpui.
  • Props to set first: models, items, now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI