Bencho Originals
Context
175.6Kof 200K

Features

  • Five kinds share one bar, each segment sized by its tokens against the limit, with the free space as a quiet track.
  • Hover a segment or a legend chip to dim the others; the headline number switches to that kind's count.
  • Compact squeezes the first kind (chat) to compactTo. Every segment re-flows at once and the bar gives a small squash under the press.
  • The count rolls digit by digit, formatted as 175.6K.
  • Field style draws the same budget as 200 dots, one per 1K tokens, filled column by column.
  • Mono swaps the hues for shades of the foreground colour.

API reference

<ContextMeter /> from components/bencho/context-meter.tsx

PropTypeDefaultDescription
kinds{ label, tokens, color, shade }[]chat, files, tools, system, memoryUsage per kind. The first kind is the one Compact squeezes. shade is the % of the foreground used in mono.
limitnumber200000Size of the context window in tokens.
compactTonumber24200Tokens left in the first kind after Compact.
variant"bar" | "field""bar"One stacked bar, or 200 dots.
colour"colour" | "mono""colour"A hue per kind, or shades of the foreground.
outlinedbooleanfalseAdds a hairline ring around the card, for busy backgrounds.
onCompact(compacted: boolean) => void—Called when Compact or Undo is pressed.

Keyboard interactions

TabMoves through Compact and each legend chip.
Enter / SpaceOn Compact, compacts or undoes.
Focus a chipHighlights that kind, the same as hovering it.

Accessibility

  • The bar and the field are role="img" with a label like “126.4K of 200.0K tokens used”.
  • Compact is a toggle button with aria-pressed.
  • Legend chips are buttons labelled with their kind and count; the headline number sits in a polite live region.

Sound & haptics

Silent by design: no audio and no vibration. All of the feedback is visual, so it works anywhere, muted or not.

Files

Written from scratch for sher.md and inspired by bencho.dev. It contains none of bencho's code or assets.