# Barge in

Talking over the agent, made visible: its voice wave yields while yours spreads into the space.

Also called: voice interruption, interrupt voice.

> 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: Talking over the agent. The agent is speaking; you cut in and its wave yields, flattening and drawing back while yours rises into the space; then it takes the floor back. Preview: https://chatcn.dev/preview/barge-in-demo

The agent's voice fills the strip as a wave. The moment you start speaking, its wave yields: it squeezes toward its own end and steps back in tone while yours spreads into the space it leaves, and the label says it is listening. When you stop it takes the floor back the same way. Both waves read real levels.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/barge-in
```

## Usage

```tsx
import { BargeIn } from "@/components/ui/chatcn/pro/barge-in"

<BargeIn speaker={floor} agentLevel={tts.getLevel} userLevel={mic.getLevel} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `speaker` | `"agent" | "user" | "none"` | Who holds the floor |
| `agentLevel` / `userLevel` | `() => number` | 0 to 1, read every frame |
| `agentName` / `userName` | `string` | Default Agent and You |

## Accessibility

- The waves are decorative; who is speaking is a polite `role="status"`.

## Motion

- The floor is a critically damped spring on the agent's share; bars are `scaleY` transforms. Reduced motion: the share jumps.

Source: https://chatcn.dev/docs/components/barge-in