Pipecat UI
Components

User Audio Control

Microphone mute toggle with live visualizer and a mic/speaker device picker.

Open in Storybook

Installation

pnpm dlx shadcn@latest add @pipecat/user-audio-control

Also installs @pipecat/device-select, @pipecat/audio-visualizer-bar as registry dependencies.

Usage

import { UserAudioControl } from "@/components/pipecat/user-audio-control";

<UserAudioControl activeText="Microphone on" inactiveText="Muted" />;

Mic toggling, the live waveform, device lists, and per-device error states (blocked, in use, not found) are wired automatically from the Pipecat client.

Modes

Toggle (default)

Click to mute and unmute:

<UserAudioControl activeText="Microphone on" inactiveText="Muted" />

Push to talk

The mic stays muted unless held open — press and hold the button, or hold the global hotkey (` by default), rendered as a key hint in place of the toggle labels. Releasing re-mutes after a short debounce, and a pulsing outline marks the mic as live. A switch in the device dropdown lets users flip modes at runtime.

<UserAudioControl
  defaultMode="push-to-talk"
  pttKey="KeyT" // any KeyboardEvent.code; null disables the hotkey
  onPttOn={() => bing.play()}
  onPttOff={() => bong.play()}
/>

Key props

PropTypeDescription
mode / defaultMode / onModeChange"toggle" | "push-to-talk"Interaction mode — controlled, or initial + runtime switch
pttKeystring | nullPush-to-talk hotkey as a KeyboardEvent.code (default "Backquote"); null disables it
pttKeyLabelstringText around the hotkey chip, [key] marking the chip (default "press [key] to talk"; "" hides the hint)
debounceMsnumberQuiet period before push-to-talk release re-mutes (default 200)
onPttOn / onPttOff() => voidChime hooks — fired once per hold as push-to-talk engages / releases
pttActiveOutlinebooleanPulsing active-colored outline while the mic is held open (default true)
noModeSwitchbooleanHide the mode switch in the device dropdown
activeText / inactiveTextReactNodeState labels (toggle mode only)
loadingTextReactNodeText next to the spinner while devices initialize
noDevicePickerbooleanHide the split-button dropdown
noMicrophones / noSpeakersbooleanHide a section of the picker
noIconbooleanHide the mic icon
noVisualizerbooleanHide the in-button waveform
visualizerPropsAudioVisualizerBarViewPropsTune the embedded visualizer
variant / sizeButton propsStyling passthrough; icon sizes (icon, icon-sm, …) render the toggle icon-only

UserAudioControlView accepts the mic state, device lists, and callbacks as props for custom state management.

On this page