Prerequisites
React 18 or higher
An ElevenLabs Conversational AI agent ID
Installation
Install the package from npm:The widget requires
react and react-dom as peer dependencies. If your project doesn’t already have them:Quick Start
Import the component and render it anywhere in your app:How It Works
- The
<ChatWidget>uses theuseConversationhook from@elevenlabs/reactto manage two separate sessions — one for voice calls and one for text chat. - A WebSocket proxy intercepts the ElevenLabs connection to read transcripts and inject context updates in real time.
- The widget renders a complete chat UI — floating action button, agent card with avatar, voice call controls with timer, and a full text chat interface — all as inline React components.
Features
Voice Calls
One-click voice calls with real-time audio visualization, call timer, and automatic transcript capture.
Text Chat
Full text chat with message bubbles, typing input, and real-time agent responses.
SPA Navigation
Built-in
navigateToPage and scrollToSection client tools let the agent navigate users around your app.Dynamic Context
Pass dynamic variables to your agent so it has context about the current user, page, or application state.