React UI Components
Pre-built, themeable React components for voice agent interfaces — conversation views, audio-reactive visualizers, and control buttons.
These components require an AgentProvider ancestor. See React Hooks for provider setup. For the core JavaScript SDK, see JavaScript.
Installation
Import the stylesheet in your app’s entry point:
@deepgram/ui re-exports all hooks from @deepgram/react and all types from @deepgram/agents. You can import everything from a single package.
Live Preview
The embedded widget below uses the components documented on this page — conversation panel, start button, microphone toggle, speaker toggle, text input, and the orb visualizer.
Usage
A complete voice agent interface in under 30 lines:
Replace YOUR_AGENT_ID with a Reusable Agent Configuration UUID, or pass an inline agent config object instead. See Agent Configuration for both patterns.
Every component is optional. Use one or all, and mix them with your own components inside the provider.
Display Components
AgentStatus
Renders the current connection state as a text label. Updates automatically as the session connects, disconnects, or reconnects.
Connected
Props:
Default labels: "Not started", "Connecting...", "Connected", "Reconnecting...", "Disconnected".
Data attributes: data-agent-status, data-state (current state value).
AgentConversation
Scrollable conversation history showing user and agent messages.
What time is my next meeting?
You have a 1:1 with Sarah at 3:30 PM.
Props:
Data attributes: data-agent-conversation on the container, data-role="user" or data-role="assistant" on each message.
Response
Lightweight markdown renderer for agent text. Handles bold, italic, inline code, code blocks, lists, headings, links, and horizontal rules. Supports streaming — update the children string as tokens arrive.
Voice agents combine speech-to-text, an LLM, and text-to-speech in a single connection.
- Low-latency conversation
- Natural prosody
Props:
Data attributes: data-agent-response.
Input Components
AgentTextInput
Text input field for sending messages to the agent. Submits on Enter (Shift+Enter for newline).
Props:
Data attributes: data-agent-text-input.
Control Components
AgentStartButton
Connect/disconnect toggle button. Reflects the current session state automatically.
Props:
Data attributes: data-agent-start-button, data-state (current state value).
AgentMicrophoneButton
Microphone mute/unmute toggle. Renders SVG mic icons by default.
Props:
Data attributes: data-agent-mic-button, data-state ("active", "muted", "inactive", or "disabled").
AgentSpeakerButton
Speaker mute/unmute toggle. Renders SVG speaker icons by default.
Props:
Data attributes: data-agent-speaker-button, data-state ("active" or "muted").
VoiceButton
All-in-one button that combines connection and mode state into a single control. The appearance changes across five lifecycle states: idle, connecting, listening, speaking, and error.
Props:
Default labels: "Start conversation", "Connecting...", "Listening...", "Agent speaking", "Error".
Style each state with the data-voice-state attribute:
Data attributes: data-agent-voice-button, data-voice-state ("idle", "connecting", "listening", "speaking", "error").
Visualization Components
Orb
Deepgram’s animated hoop visualization. Canvas 2D rendering of four crescent arcs with gradient colors — lightweight and works everywhere without WebGL. Audio-reactive: the orb responds to actual microphone input and agent playback volume in real time.
Three visual states:
- idle — deflated crescent, slow rocking, minimal animation
- listening — full circle, gentle pulse, mic-reactive radius flutter
- talking — crescent mouth, fast rotation, volume-modulated mouth movement
Props:
Automatic mode (default inside AgentProvider):
The orb reads getInputVolume() and getOutputVolume() every animation frame with zero re-renders.
Manual mode — push volume values directly:
Custom volume sources:
Custom colors:
Data attributes: data-agent-orb, data-orb-state ("idle", "listening", "talking").
BarVisualizer
Real-time frequency bar visualization. Renders vertical bars on a canvas that react to audio input or output.
Props:
Data attributes: data-agent-bar-visualizer.
LiveWaveform
Smooth oscillating waveform driven by a volume source. Blends two sine waves for an organic feel.
Props:
Data attributes: data-agent-live-waveform.
Utility Components
MicSelector
Dropdown for selecting the audio input device. Enumerates available microphones, requests permission on first open, and updates automatically when devices are plugged in or removed.
Props:
Data attributes: data-agent-mic-selector.
Theming
All components use CSS custom properties scoped to [data-dg-agent]. Add this attribute to your container element to apply the theme. Because these are standard CSS custom properties, they work with any CSS framework — Tailwind, CSS Modules, or plain stylesheets.
Design tokens
Tokens follow the shadcn --color-* naming convention generated by Tailwind v4’s @theme. The package ships sensible light defaults; dark values are applied automatically when [data-dg-scheme="dark"] is set or when the user’s system prefers dark mode. Override any token on a [data-dg-agent] ancestor to retheme.
Color scheme
Light/dark switching is driven by the data-dg-scheme attribute on the same element that has data-dg-agent. Without an explicit value, the components follow the user’s prefers-color-scheme.
If your app uses Tailwind’s dark: variant or next-themes, write a small effect that mirrors that state onto data-dg-scheme. The package does not infer it from a .dark ancestor class.
Custom theme example
A teal-on-midnight palette called Aurora, applied entirely through CSS custom properties on the host element. Same components, completely different feel.
Apply the class to your [data-dg-agent] container (or extend the override to the element itself) and every component inside picks up the new palette. The same pattern works for any palette — swap the values, keep the keys.
Styling with Data Attributes
Components use data-agent-* attribute selectors instead of class names. This prevents collisions with your application’s CSS framework — no specificity battles with Tailwind utilities or CSS Modules hashes.