Skip to content
Kits

Context

BetaBeta — the props contract is close to final, but small breaking changes can still land.

Compact context-window usage with an automatically derived token graph and anchored detail inspector.

Examples

Composed inspector and legend

Compose the header, summary, and graph yourself, and write the legend rows with ContextLegendItem to group segments or name the remaining budget.

Composition

Context inspector

Omitting children uses the built-in trigger and content. Add a header when composing a custom inspector; ContextBody scrolls under it. ContextLegend derives one row per segment; pass ContextLegendItem children to write the rows yourself.

  • <Context>
    • <ContextTrigger />
    • <ContextContent>
      • <ContextHeader>
        • <ContextTitle />
        • <ContextDescription />
        • <ContextClose />
        </ContextHeader>
      • <ContextBody>
        • <ContextSummary />
        • <ContextGraph />
        • <ContextLegend>
          • <ContextLegendItem />
          </ContextLegend>
        </ContextBody>
      </ContextContent>
    </Context>

Installation

Use this command to install the component.

Registry command
See registry manifest

Usage

Dependencies

Derivation modelsrc/registry/sources/control-ui/context-model.tsSupport
ButtonbuttonComponentPopoverpopoverComponentScroll areascroll-areaComponent

Raw code

Installed component source and support files

src/registry/sources/control-ui/context.tsx

Knobs

Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.

--cui-context-* · 11 knobsHow the cascade resolves
--cui-context-graph-radius<length-percentage>9999px
--cui-context-legend-indicator-radius<length-percentage>9999px
--cui-context-segment-system-fill<color>oklch(from var(--foreground) l c h / 0.75)
--cui-context-segment-cache-fill<color>oklch(from var(--muted-foreground) l c h / 0.55)
--cui-context-track-fill<color>var(--muted)
--cui-context-segment-tool-fill<color>var(--primary)
--cui-context-segment-message-fill<color>oklch(from var(--primary) l c h / 0.65)
--cui-context-segment-source-fill<color>oklch(from var(--accent-foreground) l c h / 0.65)
--cui-context-segment-reasoning-fill<color>oklch(from var(--foreground) l c h / 0.5)
--cui-context-overage-fill<color>oklch(from var(--destructive-text) l c h / 0.22)
--cui-context-limit-marker-color<color>var(--destructive-text)