Skip to content
Sign in
VoiceTurn indicatorMenu

Turn indicatorPro

Who has the floor in a voice call, with live level bars, and a barge-in mark when the user talks over the agent. The turn timeline shows the whole call as two lanes with every barge-in as a mark you can jump to.

ProA live call with who has the floor above the transcript and the turns below it. The caller cuts in on the second answer.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/turn-indicator

Usage

tsx
import { TurnIndicator, TurnTimeline } from "@/components/ui/chatcn/pro/turn-indicator"

<TurnIndicator speaker="agent" agentLevel={agent.getLevel} userLevel={mic.getLevel} />
<TurnTimeline turns={turns} duration={elapsed} onSelectBargeIn={(b) => seek(b.at)} />

speaker is none, user, agent or both; both is a barge-in and lights both sides with a mark. Turns are { id, speaker, start, end?, interrupted? } in ms; a user turn that starts inside an agent turn is a barge-in, and its overlap is how long both voices ran together. findBargeIns from the voice kit gives you the same list for your own analytics.

Examples

Every state

ProNobody, you, the agent, thinking and a barge-in, then a finished call's timeline with and without barge-ins.

Props

PropTypeNotes
speaker"none" | "user" | "agent" | "both"TurnIndicator. Who has the floor
thinkingbooleanTurnIndicator. The thinking label on the agent's side
userLevel, agentLevelnumber | () => numberTurnIndicator. Drive the bars
turnsVoiceTurn[]TurnTimeline. Open turns run to duration
durationnumberTurnTimeline. Call length, or elapsed while live
livebooleanTurnTimeline. Marks the end as live
onSelectBargeIn, activeBargeIn(b: BargeIn) => void, stringTurnTimeline. Jump to and highlight a barge-in
userLabel, agentLabelstringBoth. Default You and Assistant

Keyboard

KeyAction
Tab, EnterThrough the barge-in marks; Enter selects one

Accessibility

  • The indicator announces floor changes and barge-ins politely, never level ticks.
  • The timeline lanes are one image with a summary: turns, talk time per side and the barge-in count. Each barge-in is a button that reads its time and overlap.
  • Barge-ins carry a hand glyph and a label, never color alone.

Motion

  • The floor slides between the two sides in 280 ms with the in-out curve and spans both during a barge-in; under reduced motion it jumps.