Skip to content
Product block

Call Device Settings

The green room, where every picker has a test beside it - an input meter, a test tone, a camera preview - and blocked permission is a state, not an error.

315 lineslucide-reactAdded 13 Sept 2026
  • call
  • devices
  • microphone
  • camera
  • settings

What's included

  • components/call-device-settings.tsx
  • Needs lucide-react

Works with

  • React
  • Next.js
  • Tailwind CSS
  • TypeScript

npx hoverlab add call-device-settings

Or over MCP, from your editor's agent — no account needed.

License

Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.

Was this useful?

Start a page with this section — add more, order them, and leave with the page source.

Preview

Check your setup

Ninety seconds of every call goes on “can you hear me”. This is where that gets settled instead.

Say something — the bar should move. If it does not, pick another input.

A dropdown cannot tell you whether the output actually works.

These choices are remembered for the next call on this device.

Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.

Source

components/call-device-settings.tsx
'use client'

/**
 * <CallDeviceSettings> — the green room, and why it is not optional.
 *
 * The first ninety seconds of most calls are spent on "can you hear me". A
 * device panel that lets someone find out before joining removes that, and the
 * difference between one that works and one that does not is entirely in
 * whether it lets you *test*, rather than only *choose*.
 *
 * SO EVERY PICKER HAS A TEST BESIDE IT
 *
 *   microphone   a live input meter, so you can see your own voice register
 *   speaker      a test tone, because a correctly selected dead output is the
 *                commonest fault and a dropdown cannot reveal it
 *   camera       a preview, with the mirror toggle people always want
 *
 * A settings panel with three selects and a Join button is a panel that
 * confirms nothing.
 *
 * PERMISSION IS A STATE, NOT AN ERROR
 *
 * Blocked camera access is not a failure to handle in a catch — it is a state
 * the panel has to render, with the browser-specific instruction to fix it,
 * because "check your browser settings" helps nobody. It is shown here as a
 * first-class variant rather than as an afterthought toast.
 *
 * THE METER IS SIMULATED IN THIS DEMO. Real input levels need
 * `getUserMedia` and an `AnalyserNode`, which a catalog preview should not
 * request; the animation is driven by a timer and is `motion-safe:` so a
 * reduced-motion reader is not given a permanently moving bar. Swap the timer
 * for the analyser and nothing else changes.
 *
 * ACCESSIBILITY: the meter is a `role="meter"` with real values rather than a
 * decorative bar; each device select is labelled and its test button names the
 * device it tests; the blocked-permission panel is `role="alert"`; the join
 * button states what will happen — "Join with microphone off" — instead of
 * relying on two toggles the user has to re-read.
 */

import * as React from 'react'
import { Camera, CameraOff, Mic, ShieldAlert, Volume2 } from 'lucide-react'

export interface DeviceOption {
  id: string
  label: string
}

export interface CallDeviceSettingsProps {
  microphones?: DeviceOption[]
  speakers?: DeviceOption[]
  cameras?: DeviceOption[]
  /** Renders the blocked-permission state instead of the preview. */
  cameraBlocked?: boolean
  className?: string
}

const DEFAULT_MICS: DeviceOption[] = [
  { id: 'm1', label: 'Headset microphone (Jabra Evolve)' },
  { id: 'm2', label: 'Built-in microphone' },
  { id: 'm3', label: 'Webcam microphone (Logitech C920)' },
]

const DEFAULT_SPEAKERS: DeviceOption[] = [
  { id: 's1', label: 'Headset (Jabra Evolve)' },
  { id: 's2', label: 'Built-in speakers' },
  { id: 's3', label: 'Display audio (Dell U2723)' },
]

const DEFAULT_CAMERAS: DeviceOption[] = [
  { id: 'c1', label: 'Logitech C920' },
  { id: 'c2', label: 'Built-in camera' },
]

const SELECT_CLASS =
  'w-full rounded-lg border border-border bg-background px-3 py-2 text-sm outline-none transition-colors focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring'

export function CallDeviceSettings({
  microphones = DEFAULT_MICS,
  speakers = DEFAULT_SPEAKERS,
  cameras = DEFAULT_CAMERAS,
  cameraBlocked = false,
  className = '',
}: CallDeviceSettingsProps) {
  const uid = React.useId()
  const [micId, setMicId] = React.useState(microphones[0]?.id ?? '')
  const [speakerId, setSpeakerId] = React.useState(speakers[0]?.id ?? '')
  const [cameraId, setCameraId] = React.useState(cameras[0]?.id ?? '')
  const [micOn, setMicOn] = React.useState(true)
  const [cameraOn, setCameraOn] = React.useState(!cameraBlocked)
  const [mirrored, setMirrored] = React.useState(true)
  const [level, setLevel] = React.useState(0)
  const [tone, setTone] = React.useState(false)

  // Simulated. Swap the timer for an AnalyserNode and nothing else changes.
  React.useEffect(() => {
    if (!micOn) {
      setLevel(0)
      return
    }
    let step = 0
    const tick = window.setInterval(() => {
      step += 1
      setLevel(30 + Math.round(35 * Math.abs(Math.sin(step / 3))))
    }, 180)
    return () => window.clearInterval(tick)
  }, [micOn])

  function playTone() {
    setTone(true)
    window.setTimeout(() => setTone(false), 1400)
  }

  const micLabel = microphones.find((m) => m.id === micId)?.label ?? 'microphone'
  const speakerLabel = speakers.find((s) => s.id === speakerId)?.label ?? 'speaker'

  return (
    <section className={`bg-background px-4 py-10 sm:px-6 ${className}`}>
      <div className="mx-auto max-w-3xl">
        <h2 className="text-xl font-bold tracking-tight">Check your setup</h2>
        <p className="mt-1 text-sm text-muted-foreground">
          Ninety seconds of every call goes on &ldquo;can you hear me&rdquo;.
          This is where that gets settled instead.
        </p>

        <div className="mt-6 grid gap-5 sm:grid-cols-2">
          {/* ---- Camera preview, or the permission state ---------------- */}
          <div>
            {cameraBlocked ? (
              <div
                role="alert"
                className="flex h-48 flex-col items-center justify-center gap-2 rounded-xl border border-destructive/40 bg-destructive/5 p-4 text-center"
              >
                <ShieldAlert aria-hidden className="h-6 w-6 text-destructive" />
                <p className="text-sm font-semibold text-destructive">
                  Camera access is blocked
                </p>
                {/* The instruction, not "check your browser settings". */}
                <p className="text-xs text-muted-foreground">
                  Click the padlock beside the address bar, set Camera to Allow,
                  then reload this page. You can join without video in the
                  meantime.
                </p>
              </div>
            ) : (
              <div
                className="grid h-48 place-items-center overflow-hidden rounded-xl bg-foreground/10"
                style={{ aspectRatio: '4 / 3' }}
              >
                {cameraOn ? (
                  <span
                    aria-hidden
                    // The mirror toggle people always want. scale-x is
                    // symmetric under mirroring, so it needs no rtl: twin.
                    className={`grid h-16 w-16 place-items-center rounded-full bg-primary/20 text-lg font-bold text-primary ${
                      mirrored ? 'scale-x-[-1]' : ''
                    }`}
                  >
                    YU
                  </span>
                ) : (
                  <span className="flex flex-col items-center gap-2 text-muted-foreground">
                    <CameraOff aria-hidden className="h-6 w-6" />
                    <span className="text-xs">Camera off</span>
                  </span>
                )}
              </div>
            )}

            <div className="mt-2 flex flex-wrap gap-2">
              <button
                type="button"
                onClick={() => setCameraOn((v) => !v)}
                disabled={cameraBlocked}
                aria-pressed={cameraOn}
                className="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
              >
                <Camera aria-hidden className="h-3.5 w-3.5" />
                Camera, {cameraOn ? 'on' : 'off'}
              </button>
              <button
                type="button"
                onClick={() => setMirrored((v) => !v)}
                aria-pressed={mirrored}
                disabled={!cameraOn}
                className="rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
              >
                Mirror my view
              </button>
            </div>
          </div>

          {/* ---- Devices, each with its own test ------------------------ */}
          <div className="space-y-4">
            <div>
              <label htmlFor={`${uid}-mic`} className="block text-sm font-medium">
                Microphone
              </label>
              <select
                id={`${uid}-mic`}
                value={micId}
                onChange={(e) => setMicId(e.target.value)}
                className={`mt-1.5 ${SELECT_CLASS}`}
              >
                {microphones.map((device) => (
                  <option key={device.id} value={device.id}>
                    {device.label}
                  </option>
                ))}
              </select>

              <div className="mt-2 flex items-center gap-2">
                <button
                  type="button"
                  onClick={() => setMicOn((v) => !v)}
                  aria-pressed={micOn}
                  className="inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
                >
                  <Mic aria-hidden className="h-3.5 w-3.5" />
                  {micOn ? 'On' : 'Off'}
                </button>
                {/* A real meter, not a decorative bar. */}
                <div
                  role="meter"
                  aria-label={`Input level from ${micLabel}`}
                  aria-valuenow={level}
                  aria-valuemin={0}
                  aria-valuemax={100}
                  className="h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted border border-transparent"
                >
                  <div
                    style={{ width: `${level}%` }}
                    className="h-full rounded-full bg-emerald-500 motion-safe:transition-[width] motion-safe:duration-150 border border-transparent"
                  />
                </div>
              </div>
              <p className="mt-1 text-xs text-muted-foreground">
                {micOn
                  ? 'Say something — the bar should move. If it does not, pick another input.'
                  : 'Muted, so nothing registers.'}
              </p>
            </div>

            <div>
              <label htmlFor={`${uid}-speaker`} className="block text-sm font-medium">
                Speaker
              </label>
              <select
                id={`${uid}-speaker`}
                value={speakerId}
                onChange={(e) => setSpeakerId(e.target.value)}
                className={`mt-1.5 ${SELECT_CLASS}`}
              >
                {speakers.map((device) => (
                  <option key={device.id} value={device.id}>
                    {device.label}
                  </option>
                ))}
              </select>
              <button
                type="button"
                onClick={playTone}
                className="mt-2 inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
              >
                <Volume2 aria-hidden className="h-3.5 w-3.5" />
                Play a test tone
                {/* Names the device it tests. */}
                <span className="sr-only"> through {speakerLabel}</span>
              </button>
              <p aria-live="polite" className="mt-1 text-xs text-muted-foreground">
                {tone
                  ? `Playing through ${speakerLabel}. Heard nothing? A correctly selected dead output is the commonest fault.`
                  : 'A dropdown cannot tell you whether the output actually works.'}
              </p>
            </div>

            <div>
              <label htmlFor={`${uid}-camera`} className="block text-sm font-medium">
                Camera
              </label>
              <select
                id={`${uid}-camera`}
                value={cameraId}
                onChange={(e) => setCameraId(e.target.value)}
                disabled={cameraBlocked}
                className={`mt-1.5 ${SELECT_CLASS} disabled:opacity-50`}
              >
                {cameras.map((device) => (
                  <option key={device.id} value={device.id}>
                    {device.label}
                  </option>
                ))}
              </select>
            </div>
          </div>
        </div>

        <div className="mt-6 flex flex-wrap items-center justify-between gap-3 border-t border-border pt-4">
          <p className="text-xs text-muted-foreground">
            These choices are remembered for the next call on this device.
          </p>
          {/* States what will happen, rather than leaving two toggles to re-read. */}
          <button
            type="button"
            className="rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
          >
            Join with microphone {micOn ? 'on' : 'off'} and camera{' '}
            {cameraOn ? 'on' : 'off'}
          </button>
        </div>
      </div>
    </section>
  )
}

Before you paste

  • Styling is Tailwind utility classes on semantic tokens (bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.
  • Install: npm i lucide-react
  • Every prop has a default, so it renders standalone before you wire it up.

Where it goes

Drop it at components/call-device-settings.tsx and import it where you need the section:

import { CallDeviceSettings } from '@/components/call-device-settings'

Customize

1 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.

Props

Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.

PropTypeDefault
microphonesDeviceOption[]DEFAULT_MICS
speakersDeviceOption[]DEFAULT_SPEAKERS
camerasDeviceOption[]DEFAULT_CAMERAS
cameraBlockedRenders the blocked-permission state instead of the preview.booleanfalse
classNamestring''

Not using React?

The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.

This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.

call-device-settings.html
<!--
  Call Device Settings — markup from the Hoverlab catalog.

  This is the block rendered once to HTML and wrapped as a component
  file. It is not a port of the React source: the Tailwind classes carry
  the design, which is the part that took the work, and they are the same
  in every framework.

  This block is interactive in React and the handlers are NOT here.
  Buttons, toggles and menus render in their initial state and do
  nothing until you wire them up.
-->
<section class="bg-background px-4 py-10 sm:px-6 ">
  <div class="mx-auto max-w-3xl">
    <h2 class="text-xl font-bold tracking-tight">Check your setup</h2>
    <p class="mt-1 text-sm text-muted-foreground">Ninety seconds of every call goes on “can you hear me”. This is where that gets settled instead.</p>
    <div class="mt-6 grid gap-5 sm:grid-cols-2">
      <div>
        <div class="grid h-48 place-items-center overflow-hidden rounded-xl bg-foreground/10" style="aspect-ratio:4 / 3">
          <span aria-hidden="true" class="grid h-16 w-16 place-items-center rounded-full bg-primary/20 text-lg font-bold text-primary scale-x-[-1]">YU</span>
        </div>
        <div class="mt-2 flex flex-wrap gap-2">
          <button type="button" aria-pressed="true" class="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-camera h-3.5 w-3.5" aria-hidden="true"><path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"></path><circle cx="12" cy="13" r="3"></circle></svg>Camera, on</button>
          <button type="button" aria-pressed="true" class="rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">Mirror my view</button>
        </div>
      </div>
      <div class="space-y-4">
        <div>
          <label for="_R_0_-mic" class="block text-sm font-medium">Microphone</label>
          <select id="_R_0_-mic" class="mt-1.5 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm outline-none transition-colors focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring">
            <option value="m1" selected="">Headset microphone (Jabra Evolve)</option>
            <option value="m2">Built-in microphone</option>
            <option value="m3">Webcam microphone (Logitech C920)</option>
          </select>
          <div class="mt-2 flex items-center gap-2">
            <button type="button" aria-pressed="true" class="inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-mic h-3.5 w-3.5" aria-hidden="true"><path d="M12 19v3"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><rect x="9" y="2" width="6" height="13" rx="3"></rect></svg>On</button>
            <div role="meter" aria-label="Input level from Headset microphone (Jabra Evolve)" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted border border-transparent">
              <div style="width:0%" class="h-full rounded-full bg-emerald-500 motion-safe:transition-[width] motion-safe:duration-150 border border-transparent"></div>
            </div>
          </div>
          <p class="mt-1 text-xs text-muted-foreground">Say something — the bar should move. If it does not, pick another input.</p>
        </div>
        <div>
          <label for="_R_0_-speaker" class="block text-sm font-medium">Speaker</label>
          <select id="_R_0_-speaker" class="mt-1.5 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm outline-none transition-colors focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring">
            <option value="s1" selected="">Headset (Jabra Evolve)</option>
            <option value="s2">Built-in speakers</option>
            <option value="s3">Display audio (Dell U2723)</option>
          </select>
          <button type="button" class="mt-2 inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-volume2 lucide-volume-2 h-3.5 w-3.5" aria-hidden="true"><path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"></path><path d="M16 9a5 5 0 0 1 0 6"></path><path d="M19.364 18.364a9 9 0 0 0 0-12.728"></path></svg>Play a test tone<span class="sr-only"> through Headset (Jabra Evolve)</span></button>
          <p aria-live="polite" class="mt-1 text-xs text-muted-foreground">A dropdown cannot tell you whether the output actually works.</p>
        </div>
        <div>
          <label for="_R_0_-camera" class="block text-sm font-medium">Camera</label>
          <select id="_R_0_-camera" class="mt-1.5 w-full rounded-lg border border-border bg-background px-3 py-2 text-sm outline-none transition-colors focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50">
            <option value="c1" selected="">Logitech C920</option>
            <option value="c2">Built-in camera</option>
          </select>
        </div>
      </div>
    </div>
    <div class="mt-6 flex flex-wrap items-center justify-between gap-3 border-t border-border pt-4">
      <p class="text-xs text-muted-foreground">These choices are remembered for the next call on this device.</p>
      <button type="button" class="rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background">Join with microphone on and camera on</button>
    </div>
  </div>
</section>
  • This is rendered HTML, not a translation of the React source. The Tailwind classes carry the design and work in any framework.
  • It is one frame: the component in its initial state, with no props applied beyond the defaults.
  • This block is interactive in React — toggles, menus or form state. None of that survives here; the markup is the closed/default state and the handlers are gone. Re-wire them in your own framework.
  • Requires Tailwind, and the design tokens the classes reference (bg-card, text-muted-foreground, and so on). The template ZIPs ship a globals.css that defines them.

What each framework gets across the whole catalog — effects convert properly; this rung is markup.

For AI

The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.

See the prompt

8 more blocks in Communication

All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.

Browse Communication

Shipping one commercially

Copying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.

  • A commercial licence for everything in the catalog
  • Unlimited bundle exports, in Vue, Svelte and Tailwind
  • One payment — no subscription, nothing to renew
Pro — $79 once

More Communication blocks

View category
Open the full page for this block

Support Chat Widget

The corner launcher, with real availability instead of a stock reassurance, article deflection before the form, no self-opening, and a way to make it go away.

Communication307 lines1 dep
Open the full page for this block

Message Bubble Thread

Bubbles with the parts that get skipped: per-message delivery state, grouping by author and time, day separators, and a retry on the failed bubble itself.

Communication325 lines1 dep

Attachment Bubbles

Five kinds of thing that is not text - image, document, link, location and an upload still in flight - each answering the question its own kind raises.

Communication305 lines1 dep
Open the full page for this block

Inbox Thread List

The list half of a two-pane inbox, with unread and selected as visibly different states and bulk selection as a mode rather than a hover checkbox.

Communication333 lines1 dep
Open the full page for this block

Inbox Reading Pane

The reading pane with the composer always present, quoted history collapsed behind a count, and an internal-note mode whose send button names the recipient.

Communication311 lines1 dep
Open the full page for this block

Voice Message Player

A voice note you can navigate: a waveform that is a real seek control, a speed button, a transcript, and a played state that survives finishing.

Communication271 lines1 dep
Open the full page for this block

Video Call Layout

The call grid with the state that makes it usable - active speaker, per-tile connection quality, hide self-view, and the you-are-muted nudge.

Communication286 lines1 dep
Open the full page for this block

Support Ticket Thread

The customer side of a ticket, where a named owner and a deadline replace Status: Open - including the waiting-on-you state that stops the argument about response times.

Communication340 lines1 dep