voicedock

ui component for voice sessions

the control bar of a live voice session, beads on one thread, shown at actual size.

actual size

states

size

look

install

a react component: the command at the top installs it, or copy its two files. the dock only draws: the session, the microphone and the menu stay in your app, and it tells you through the callbacks what the user pressed.

import { useState } from "react";
import { VoiceDock } from "@likemiens/voice-dock"; // brings voice-dock.css with it

export function CallBar({ call, labels }) {
  const [muted, setMuted] = useState(false);
  const [sharing, setSharing] = useState(false);
  const [menuOpen, setMenuOpen] = useState(false);
  return (
    <VoiceDock
      status={call.status} // "connecting" | "live" | "reconnecting" | "ended"
      muted={muted}
      sharing={sharing}
      menuOpen={menuOpen}
      level={() => call.level()} // 0…1, read every frame
      size={42}
      appearance="glass" // or "flat"
      labels={labels}
      onMutedChange={setMuted}
      onSharingChange={setSharing}
      onMenuOpenChange={setMenuOpen}
      onExit={() => call.leave()}
    />
  );
}

githubMIT

api

props

statusconnecting · live · reconnecting · endedthe session, shown by the dot and its word; ended folds every bead into the first
mutedbooleanthe microphone is off: a slash is drawn across the waveform
sharingbooleanthe screen is shared: the window lights up
menuOpenbooleanthe menu bead is open; the menu itself is yours to render
level0…1 · () => 0…1the voice; a function is read every frame, so a meter re-renders nothing
armedboolean, optionalexit waits for its second press; leave it out and the dock keeps it, letting go after 4 s
size36 · 42 · 48the height of a bead, 48 by default; the whole dock zooms, tooltips keep their size
appearanceglass · flatglass, the default: smoked glass tinted bead by bead with the colour of its state, lit icons and words; flat: the plain grey
labelsVoiceDockLabelsevery word the dock shows or says to a screen reader

callbacks

onMutedChange(muted) => voida press on the microphone
onSharingChange(sharing) => voida press on the screen
onMenuOpenChange(open) => voida press on the menu bead
onArmedChange(armed) => voidexit asks once more, or lets go
onExit() => voidthe second press of exit; set status to ended to fold the dock

keyboard

← → home endbetween the beads
enter spacepress
esctakes exit back, closes the menu

colours

--vd-surfaceglass—flat#eaebe9
--vd-glassglassrgb(24 24 27 / 92%)flat—
--vd-inkglassrgb(255 255 255 / 92%)flat#3f4247
--vd-quietglassrgb(255 255 255 / 30%)flat#caccc9
--vd-liveglass#4ade80flat#5eb948
--vd-warnglass#facc15flat#e8a13a
--vd-dangerglass#fb7185flat#e5484d
--vd-shareglass#38bdf8flat--vd-live
--vd-focusglass#7cc4ffflat#0c75f1

more components