A searchable popover for picking an audio input — permission-aware labels, live device updates, and width-matched content.
Default
Popover list of audio inputs. Opening requests mic permission so device names resolve.
Loading…
Installation
CLI
Also needs
npx @sonojs/ui@latest add button command popover && npm i lucide-reactUsage
mic-selector.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | string | — | Selected device ID (controlled or uncontrolled). |
| onValueChange | (deviceId?: string) => void | — | Fires when the selected microphone changes. |
| open / onOpenChange | boolean / (open: boolean) => void | — | Popover open state. Opening without permission requests mic access. |
| MicSelectorList children | (devices: MediaDeviceInfo[]) => ReactNode | — | Render prop with the current audioinput devices. |
| MicSelectorLabel device | MediaDeviceInfo | — | Splits hardware IDs like `(1a2b:3c4d)` into muted suffix text. |
| useAudioDevices() | hook | — | Standalone hook: `devices`, `loading`, `error`, `hasPermission`, `loadDevices`. |