Microphone selector

A React component in Beamline's Voice & audio category.

Choose the microphone, test it with a live level and mute it, with every permission and device state spelled out: not yet allowed, blocked (and how to unblock), no microphone, unplugged. Shares its microphone with the rest of the screen.

Use it for

  • Before recording, dictating or joining a call.
  • Voice settings: input choice, a level test and mute.

Not for

Anatomy

  • label
  • device select (system default first)
  • test button (the same control as Allow microphone: its words turn into Test, then Stop test)
  • level preview (live-waveform)
  • mute toggle
  • state message (allow, blocked, no device) with the fix and a retry

Variants

  • size: sm, md, lg

States

  • permission not asked ("Allow microphone")
  • asking
  • allowed, idle (names listed)
  • testing (live level)
  • muted (level stops: Muted between dashed rules; the readout says Unmute to test)
  • blocked (how to unblock, Try again)
  • no microphone / unplugged (plug one in, Try again; the list refreshes on its own)
  • unsupported or insecure page
  • disabled

Keyboard

  • Tab: select, test, mute
  • Select: Enter / Space / ↓ opens, arrows move, Enter chooses
  • Test and Mute are toggle buttons (aria-pressed)

Motion

Allow microphone becomes Test in place (the button's label morph and width spring). The level preview grows in under the controls (.enter-grow) and a failure grows in the same way, so what is below glides; the preview runs only while testing and on screen; nothing runs otherwise.

Props

PropTypeDefaultDescription
microphoneMicrophone—Share a microphone from useMicrophone() with a speech input or a call on the same screen.
value / defaultValue / onValueChangestring—value: Device id ("" = system default), when no microphone is passed. defaultValue: Initial microphone device id when uncontrolled. Defaults to the browser-selected microphone. onValueChange: Reports microphone device id after an edit; no callback by default.
muted / defaultMuted / onMutedChangeboolean—muted: Mutes the source while retaining its playback or capture state; omit to use defaultMuted. defaultMuted: Initial microphone mute state when uncontrolled. Defaults to false. onMutedChange: Reports microphone mute state after a change; no callback by default.
previewbooleantrueShow the Test button and the live level. Default true.
labelstring"Microphone"Visible label or accessible name for the control. Defaults to "Microphone".
hideLabel / size / disabledboolean / "sm" | "md" | "lg" / boolean—hideLabel: Hides the label; defaults to false. Deprecated: Use showLabel={false} instead. size: Control size within the supported size steps. Defaults to "md". disabled: Prevents interaction with the control. Defaults to false.
classNamesMicSelectorClassNames—Classes for the named visual parts; no part overrides by default.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
showLabelbooleantrueShows the label visually while keeping its accessible name; defaults to true. Takes precedence over hideLabel.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
valuestring—Device id ("" = system default), when no microphone is passed.
defaultValuestring—Initial microphone device id when uncontrolled. Defaults to the browser-selected microphone.
onValueChange((deviceId: string) => void)—Reports microphone device id after an edit; no callback by default.
mutedboolean—Mutes the source while retaining its playback or capture state; omit to use defaultMuted.
defaultMutedboolean—Initial microphone mute state when uncontrolled. Defaults to false.
onMutedChange((muted: boolean) => void)—Reports microphone mute state after a change; no callback by default.
hideLabelboolean—Hides the label; defaults to false. Deprecated: Use showLabel={false} instead.
size"lg" | "md" | "sm"—Control size within the supported size steps. Defaults to "md".
disabledboolean—Prevents interaction with the control. Defaults to false.
classNamestring—Classes on the documented visual root; no override by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.

Built from

Used in

Dependencies

lucide-react

Import

import { MicSelector } from "@beamline/mic-selector";

Get it

Microphone selector is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent

More in Voice & audio

  • Recorded answer: A spoken answer against a time limit: record (the microphone asked for first, a blocked one said with what to do), the running time against the limit…
  • Orb: The agent's presence: a thin ring of light around a lens in the brand's hue that holds still at rest, sends an arc round while thinking and widens with…
  • Call grid: The people on a video call, laid out for the room they are given: tiles as large as the space allows at the camera's shape, or the person talking (or a…
  • Bar visualizer: A row of bars that says what a voice agent is doing: a sweep while connecting, the person's voice while listening, a slow breath while thinking, the…
  • Matrix: A dot-matrix display: animated frame sets (loading, pulse, wave, syncing), text and digits in a 5×7 font, or a VU meter of levels or a live source. One…
  • Transcript viewer: A recording and its words together: the spoken word lights up as it plays and the transcript follows it, any word or paragraph time plays from there…
  • Waveform: The shape of a recording: one bar per slice of loudness, fitted to any width, with the played part in the accent, unmeasured slices hatched and a loading…
  • Live waveform: Loudness drawn as it happens: a scrolling history of the microphone (or any live source) or its spectrum, a calm processing state while words are…
  • Conversation bar: The control bar of a voice call with an agent: one button to call and hang up, the agent's state as bars, a call timer, mute, and typing when talking is…
  • Audio player: One audio element and its controls: play with a loading state, a scrub bar with time, skip, speed and a playlist whose rows play into the same player…
  • Voice button: The control that starts and stops talking: click to toggle or hold to talk (pointer, Space, Enter or a global shortcut), with a live level while…
  • Scrub bar: A seekable timeline for audio or video: elapsed and total time, what has loaded, chapter marks, a time preview under the pointer, and the full keyboard…
  • Speech input: A text field you can speak into: the mic dictates through any speech-to-text provider, the phrase being heard shows apart from the finished words, and…
  • Voice picker: Choose a text-to-speech voice from a searchable list (name, accent, tone, use) and hear it first: each voice has its own orb, previews play one at a time…

Guides: Build a voice agent UI in React

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.