Skip to documentation
svelte/elevenlabs Docs

Docs Components

Components

The live spectra, the complete conversation widget, the provider, and the CSS variables that theme them.

AudioVisualizer

AudioVisualizer paints the live analyser data from a controller. It never invents levels: when no session is active it draws a static standby grid and baseline, and when a session is live it draws the microphone and agent spectra from their analyser data.

Panel.svelte
<script lang="ts">  import { AudioVisualizer, useConversation } from 'svelte-elevenlabs';  const conversation = useConversation({    agentId: 'agent_your_public_id'  });</script><AudioVisualizer  {conversation}  height={212}  label="Live microphone and agent room tone"/>
AudioVisualizer props
PropTypeDefaultNotes
conversationConversationController | nullnullController to read. Renders the idle state when omitted.
heightnumber176Canvas height in CSS pixels.
showLegendbooleantrueShow the YOU and AGENT labels.
labelstringLive microphone and agent audio spectraAccessible label and description source.
classstring''Extra class names on the root element.

ConversationWidget

The widget packages the target field, start and stop control, spectra, transcript, text composer, feedback, playback volume, device selectors, and telemetry. Use it as a complete surface or turn sections off and build around the parts you keep.

App.svelte
<script lang="ts">  import { ConversationWidget, useConversation } from 'svelte-elevenlabs';  const conversation = useConversation({    agentId: 'agent_your_public_id'  });</script><ConversationWidget  controller={conversation}  title="Support line"  subtitle="Voice or text"  showTelemetry={false}/>
ConversationWidget props
PropTypeDefaultNotes
controllerConversationControllerNoneExisting controller. When omitted the widget creates and destroys its own.
agentIdstring''Initial target shown in the field.
signedbooleanfalseExchange the target through the signed URL endpoint.
titlestringConversationWidget heading.
subtitlestringElevenLabs Conversational AI · Svelte 5Small line under the heading.
showTargetInputbooleantrueShow the agent id field.
showVisualizerbooleantrueShow the live spectra.
showTranscriptbooleantrueShow the transcript log.
showTelemetrybooleantrueShow latency, format, and session counters.
textOnlybooleanfalseRun widget owned sessions without audio. Ignored with controller.
showTextInputbooleantrueShow the text composer.
showFeedbackbooleantrueShow response feedback buttons.
showAudioControlsbooleantrueShow playback volume and device controls.
classstring''Extra class names on the root element.

When you pass an external controller, the widget still owns its own start and stop button but uses your controller, so state stays shared with the rest of the page. The textOnly prop is ignored in that mode because the controller already owns the mode.

ConversationProvider

The provider shares one controller through Svelte context. Pass an existing conversation, or pass options and let the provider create and destroy its own. Descendants can read it with getConversationContext() or register tools with useConversationClientTool().

App.svelte
<script lang="ts">  import { ConversationProvider, ConversationWidget } from 'svelte-elevenlabs';</script><ConversationProvider options={{ agentId: 'agent_your_public_id' }}>  <ConversationWidget /></ConversationProvider>

The context value is set during initialisation and does not change for the life of the provider. Use an external conversation when the controller must outlive the provider or come from a store.

Theme variables

Both components read CSS custom properties. Set them on a wrapping element to theme one instance, or on :root to theme every instance.

CSS custom properties
VariableUsed byPurpose
--se-panelWidgetWidget background.
--se-panel-raisedWidgetRaised controls and fields.
--se-inkWidgetPrimary text.
--se-mutedWidgetSecondary text and metadata.
--se-lineWidgetBorders and dividers.
--se-signalBothAccent color for controls and input data.
--se-agentBothLive state and agent output color.
--se-font-displayWidgetDisplay font stack.
--se-font-monoBothMono font stack.
--se-widget-radiusWidgetWidget corner radius. Defaults to 4px.
--se-viz-bgVisualizerCanvas background.
--se-viz-borderVisualizerCanvas border.
--se-viz-inkVisualizerLegend and standby text.
--se-viz-radiusVisualizerCanvas corner radius. Defaults to 2px.
CSS
.chat-shell {  --se-panel: #101014;  --se-panel-raised: #191920;  --se-ink: #f5f1e8;  --se-muted: rgba(245, 241, 232, 0.6);  --se-line: rgba(245, 241, 232, 0.16);  --se-signal: #ff6a3d;  --se-agent: #c8ff76;  --se-font-display: 'Bricolage Grotesque Variable', sans-serif;  --se-font-mono: 'Azeret Mono Variable', monospace;  --se-widget-radius: 0;  --se-viz-bg: #0a0a0c;}

Tailwind v4

The components use scoped styles. When they render utility class names inside a Tailwind v4 app, add the package output to Tailwind's source scanning:

app.css
@import 'tailwindcss';@source '../node_modules/svelte-elevenlabs/dist';

If you only use the controller and the audio helpers, no Tailwind setting is required. See Install for the package setup.

Accessibility

The visualizer exposes a text description on its figure that follows the session state, while the canvas is hidden from assistive technology. The widget uses native buttons, inputs, selects, and a labelled transcript log, and it respects prefers-reduced-motion. The default visualizer label can be replaced when the surrounding page already provides context.

Edit this page on GitHub