AI Chat Fancy Stable

ContextRing

How much of the context window is gone, in the space of a favicon: a donut that fills as the conversation grows, the compact count beside it, and an optional popover breaking the total down by what is holding it

Preview

Installation

pnpm add fancy-ui-svelte
import { ContextRing } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { ContextRing } from 'fancy-ui-svelte';
</script>

<ContextRing />

Examples

Basic Usage

Props

PropTypeDefaultDescription
usage *TokenUsageData-Context-window consumption: tokens used, out of how many, and optionally the breakdown rows the popover lists
size number28Outer diameter of the ring, in pixels; drives the viewBox and the radius
strokeWidth number3Thickness of the track and the arc, in pixels; clamped to the radius so a thick ring cannot eat its own centre
showLabel booleantrueWhether the compact "12.4k / 200k" figure is shown beside the ring — exact under a thousand, one decimal under 100k, rounded above
warnAt number0.75Fraction at which the ring leaves the quiet band and takes the running colour
criticalAt number0.9Fraction at which the ring takes the error colour. Floored at warnAt, so a threshold set below the warning cannot create a band that never wins
label string"Context usage"Accessible name for the meter, and — when expandable — for the button that contains it
expandable booleanfalseTurns the ring into a button that toggles a popover listing usage.breakdown; closes on Escape, on a click outside, or on a second press