# Voice sheet

Voice mode as a sheet over the chat: compact with the chat readable above it, or full with the big orb, live captions and controls.

> 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: Voice sheet. Tap the voice button: the sheet opens compact over the chat with live captions. Drag it up for the big orb. Preview: https://chatcn.dev/preview/voice-sheet-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/voice-sheet
```

## Usage

```tsx
import { VoiceSheet } from "@/components/ui/chatcn/pro/voice-sheet"

<VoiceSheet
  open={voiceOpen}
  onOpenChange={setVoiceOpen}
  state={state}                 // "listening" | "thinking" | "speaking" | …
  segments={segments}           // TranscriptSegment[], both sides
  elapsed={seconds}
  muted={muted}
  onMutedChange={setMuted}
  onInterrupt={interrupt}
  onEnd={hangUp}
  inputLevel={() => mic.level}
  outputLevel={() => speaker.level}
/>
```

Compact, the sheet is a bar on the lower third: a small orb, the state and time, mute, interrupt and end, and two lines of live captions; the chat above stays undimmed and usable, so people can read and scroll while they talk. Drag it up, or tap the grabber, and the same orb moves to the middle and grows, the captions get five lines at a larger size and the controls get bigger. Flicking it away ends the call, the same as End. Interrupt is enabled only while the assistant speaks. Built on the free `voice-orb` (pass level getters for 60 fps without re-renders, or `simulate` for demos) and Pro `live-captions`.

## Examples

### States

Example: States. Expanded at phone width while the assistant speaks, and compact while muted. Preview: https://chatcn.dev/preview/voice-sheet-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `open`, `onOpenChange` | `boolean` | Controlled |
| `state` | `VoiceOrbState` | Said in words next to the orb |
| `segments` | `TranscriptSegment[]` | What has been said, both sides |
| `elapsed` | `number` | Seconds since the call started |
| `muted`, `onMutedChange` | `boolean` | The mute toggle |
| `onInterrupt`, `onEnd` | `() => void` | Interrupt shows when given |
| `inputLevel`, `outputLevel`, `simulate` |  | Passed to the orb |
| `defaultExpanded` | `boolean` | Start full instead of compact |
| `labels` | `Partial<VoiceSheetLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| Arrow up, down on the grabber | Full or compact; down from compact ends |
| Escape | End the call |

## Accessibility

- A non modal dialog named Voice: the chat behind stays reachable.
- The state and time are a status message; captions announce finished lines once.
- Mute is a toggle button that reports whether it is pressed.

## Motion

The sheet moves on a critically damped spring. The orb moves and scales between compact and full with transform over 500 ms. Under reduced motion it changes in place and the orb stops moving.

Source: https://chatcn.dev/docs/components/voice-sheet