Skip to content

ContextMeter

Experimental

Shows how full the chat is, with a Summarize button when it is nearly full.

Also known as context usage, token meter, context window meter

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Normal

68% of context

Far from the limit, there is no warning and no button.

When to use it

Shows how much of the chat the assistant can still keep in mind. It stays quiet until people can do something, then warns in amber and offers to summarize.

Made of: Usage text · Bar · Warning text · Summarize button · Summarized marker

Use it for

  • A long chat that may reach the limit of what the assistant can hold.
  • Offering Summarize when the chat is nearly full.
  • Leaving a note after earlier messages have been summarized.

Not for

  • Credits or a plan allowance: use UsageMeter.
  • A limit that has already been reached: use RateLimitNotice.
  • A plain bar with no warning text or actions: use Meter.

Do and avoid

91% of contextClose to the limit.
Do. Amber only near the limit, with words and a way to fix it.
40% of contextClose to the limit.
Avoid. Warning with plenty of room left teaches people to ignore it.

Do

  • Keep the meter quiet until the person can do something about it.
  • Show the reason and the button together with amber.
  • Leave a marker after summarizing so the chat history stays honest.
  • Pass onSummarize, or the warning appears with nothing to act on.

Avoid

  • Do not warn when there is plenty of room. Amber means act now.
  • Do not show Summarize unless it works.
  • Do not rely on the bar color alone. The text carries the state.

On a phone

  • The meter fills the width, and the amount and the warning share one row.
  • The Summarize button appears under the bar when the limit is near, and has a 44px tap area on a touch screen.
  • The bar is only 6px tall and carries no tap action, so the amount in text is the part to read.

Seen in products

  • Vercel AI Elements ships a Context component.
  • Claude Code Summarize from here and Summarize up to here compact the conversation with optional guidance and leave a marker in the transcript.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started