Skip to main content
A floating voice widget has two lifecycles. Opening the panel shows the controls. Pressing Start call asks for microphone access and connects to ElevenLabs. Closing the panel ends the call, including a connection that was still starting. Install orb-ui and @elevenlabs/client@1.9.0 in a Next.js App Router project. This example uses a public ElevenLabs agent ID. For a private agent, obtain a fresh conversation token from an authenticated server route for each call. ElevenLabs session credentials

Build the launcher and call panel

Save this as app/VoiceWidget.tsx. The native dialog handles Escape, traps keyboard focus while open, and returns focus to the launcher when closed. The panel subscribes to a single adapter. It retains the SDK session to implement microphone mute.

Add the widget to one route

Import VoiceWidget into the page where visitors need voice help and render <VoiceWidget agentId="YOUR_PUBLIC_AGENT_ID" />. Use your own agent’s public ID. The client component handles the browser APIs, so the surrounding page can remain a Server Component. Test with the keyboard first. Open the dialog, start a call, mute while the agent is speaking, and press Escape. The agent audio should remain audible while the mic is muted, and closing should release capture. Reopen and start again. If permissions are denied, allow microphone access in the browser before retrying. ElevenLabs JavaScript SDK
Last modified on November 26, 2026