Skip to main content
The 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

You must import the CSS file for the widget to render correctly. Without it, the widget will be unstyled.

Props

The component accepts the following props via ThunderPhoneWidgetProps:

Examples

Dark Theme with Custom Color

Custom Position

Per-Session Language, Voice, and Context

The language, 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:
Use 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

See the Styling guide for all available CSS classes and custom properties.

With Ringtone

Play a phone-ringing sound while the connection is being established:
Use a custom ringtone by passing an audio file URL:
The ringtone loops while the widget is in the connecting state and fades out smoothly when the agent connects.

With Custom API Base

You only need to set apiBase if you are using a self-hosted or proxy API endpoint. The default points to https://api.thunderphone.com/v1.

Error Handling

When the onError 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.