# Context pour

The context window as something that fills: a file's token cost flies into the meter and the part it added stays lit.

Also called: context window animation, token meter animation.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Context you can watch fill. Each attached file pours its token cost into the meter; the part it added stays lit for a moment, the bar warns near the limit and turns red past it. Preview: https://chatcn.dev/preview/context-pour-demo

When a file or a pasted log is added, its token cost flies into the meter, the bar pours forward to the new total, and the part just added stays lit for a moment before it settles into the rest, so you can see what that one file cost. Past 80% the bar takes the amber of things near a limit; past the window it turns red and says what to do.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/context-pour
```

## Usage

```tsx
import { ContextPour, pourInto } from "@/components/ui/chatcn/pro/context-pour"

await pourInto(chipEl, meterRef.current, file.tokens)
setUsed((u) => u + file.tokens)

<ContextPour ref={meterRef} used={used} limit={200_000} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `used` | `number` | Tokens in context |
| `limit` | `number` | The model's window |
| `warnAt` | `number` | Share where it warns. Default 0.8 |
| `label` | `string` | Default "Context" |

## Accessibility

- `role="meter"` with the share in words; over the limit adds a status line that says how to fix it.

## Motion

- The fill is a heavy spring on `scaleX`; the fresh part glows in the accent and fades over 1.3 s.
- Reduced motion: no flight and the bar jumps.

Source: https://chatcn.dev/docs/components/context-pour