Props
| Prop | Type | Default | Description |
|---|---|---|---|
agentId | string | (required) | Your ElevenLabs Conversational AI agent ID |
position | "bottom-right" | "bottom-left" | "bottom-right" | Widget position on the page |
defaultOpen | boolean | false | Start with the chat panel open |
agentName | string | "Agent" | Display name shown in the widget header and agent card |
agentImageUrl | string | null | null | Custom avatar image URL. If not set, the widget auto-fetches the avatar from your ElevenLabs agent config |
dynamicVariables | Record<string, any> | undefined | Key-value pairs passed to the ElevenLabs agent as dynamic variables (e.g. current user info, page context) |
clientTools | Record<string, Function> | undefined | Custom client tools the agent can invoke. Merged with built-in tools (navigateToPage, scrollToSection) |
routerType | "browser" | "hash" | "auto" | "auto" | Router type used by your app. Controls how built-in navigation tools work |
className | string | undefined | Additional CSS class on the root container |
onCallStateChange | (state: CallUIState) => void | undefined | Callback when the call/chat state changes |
onChatMessage | (message: ChatMessage) => void | undefined | Callback fired on every message (user or agent) |
Types
The package exports these TypeScript types:Examples
With dynamic variables
Pass context to your agent usingdynamicVariables. These are sent to the ElevenLabs agent when a session starts:
With message logging
Track every message exchanged between the user and agent:With call state tracking
Monitor the widget’s connection state:Custom agent branding
If you don’t provide
agentImageUrl, the widget automatically fetches the avatar from your ElevenLabs agent configuration.Custom client tools
Register tools that the ElevenLabs agent can invoke during a conversation. These are merged with the built-innavigateToPage and scrollToSection tools:
undefined).
Hash router support
If your app uses a hash-based router (e.g.HashRouter from React Router), set routerType so the built-in navigation tools work correctly:
| Value | Behavior |
|---|---|
"auto" | Auto-detects based on whether the current URL hash looks like a route (e.g. /#/about) |
"browser" | Uses history.pushState for navigation (standard HTML5 routing) |
"hash" | Uses window.location.hash for navigation |
Built-in Client Tools
The widget registers two client tools that your ElevenLabs agent can call:navigateToPage
Navigates the user to a different page within your app. Works with both browser and hash routers.
scrollToSection
Scrolls to and highlights a specific section on the page using a spotlight effect.
For
scrollToSection to work, your page sections need id attributes (e.g. <section id="features">).Styling
The widget renders all UI with inline styles and injects its own CSS animations. No external stylesheet import is required. The component accepts aclassName prop if you need to target it for layout purposes:
#0d0d1a background) with an indigo/purple accent (#6366f1 to #7c3aed). To customize the appearance, you can override styles by targeting the widget’s fixed-position container: