ThunderPhoneWidget component renders a glassmorphic call bar with built-in controls for muting, ending the call, and displaying connection status. It is the fastest way to add voice AI to a React app.
Installation
Basic Usage
Props
The component accepts the following props viaThunderPhoneWidgetProps:
Examples
Dark Theme with Custom Color
Custom Position
Per-Session Language, Voice, and Context
Thelanguage, voice, and context props are forwarded to the session request (POST /widget/session) when a call starts, overriding the agent’s configured defaults for that session:
context to give the agent factual knowledge about the page the visitor is on — product details, pricing, or page-specific FAQs. It is truncated server-side to 12,000 characters.
With Event Callbacks
With Custom Styling
With Ringtone
Play a phone-ringing sound while the connection is being established:connecting state and fades out smoothly when the agent connects.
With Custom API Base
Error Handling
When theonError callback fires, it receives an error object with two fields:
Common error codes include domain not allowed, agent not found, and invalid API key.
Next Steps
Headless Hook
Need full control over the UI? Use the
useThunderPhone hook instead.Styling
Customize colors, sizes, and layout with CSS custom properties.