# 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.

- Package: `fancy-ui-vue` (Vue 3.5+ + Tailwind CSS v4)
- Category: AI Chat
- Tags: ai, chat, tokens, context, indicator
- Types: `ContextRingProps`
- Docs: https://fancy-ui.rama.app/docs/components/context-ring
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/vue/src/components/context-ring

## Import

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

Setup (once per project): `npm install fancy-ui-vue`, then put these lines in your main CSS file (the stylesheet imports go right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-vue/tailwind.css";
@import "fancy-ui-vue/styles.css";
```

Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in a Vue template; when one differs from the Svelte name, the Svelte name follows in parentheses. Snippets become named slots (`#default` is the default snippet), a prop the Vue port declares as a model is a `v-model:<name>` (except `ref`, exposed via `defineExpose({ ref })`: put a template ref on the component and read `.ref`) and callbacks are listeners (`onclick` is `@click`). Every component sets `inheritAttrs: false`: `class` is a declared prop, merged where the Svelte component applies it (not always the root element), and only when the props table below lists it; other attributes do not fall through unless the package README lists the component as forwarding native attributes. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/vue#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `usage` (required) | `TokenUsageData` | — | Context-window consumption: tokens used, out of how many, and optionally the breakdown rows the popover lists |
| `size` | `number` | `28` | Outer diameter of the ring, in pixels; drives the viewBox and the radius |
| `strokeWidth` | `number` | `3` | Thickness of the track and the arc, in pixels; clamped to the radius so a thick ring cannot eat its own centre |
| `showLabel` | `boolean` | `true` | Whether the compact "12.4k / 200k" figure is shown beside the ring — exact under a thousand, one decimal under 100k, rounded above |
| `warnAt` | `number` | `0.75` | Fraction at which the ring leaves the quiet band and takes the running colour |
| `criticalAt` | `number` | `0.9` | Fraction 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` | `boolean` | `false` | Turns the ring into a button that toggles a popover listing usage.breakdown; closes on Escape, on a click outside, or on a second press |
| `sound` | `boolean` | `false` | Plays open/close on the breakdown popover, once the user has enabled sound |

## Example

No Vue example is published for this component yet: start from the import above and the props table. The full examples are Svelte-only, on https://fancy-ui.rama.app/docs/components/context-ring.md.
