Skip to content

Voice Pill

Zero-dependency audio capture capsule with hardware microphone streaming or simulated speech cadence, real-time DPR-aware canvas FFT visualizer, and slide-to-cancel physics.

Dependencies

lucide-react

Interaction

Compact resting pill expands horizontally over 220ms via cubic-bezier kinematics. Unfolds real-time 80-frame canvas equalizer and monospace elapsed timer. Dragging left beyond 64px triggers physical slide-to-cancel.

Props

PropTypeDescription
accentColorstringWaveform and status accent color (Peel Acid Lime).
stopColorstringColor for active stop square and cancel indicator (Peel Coral).
iconColorstringIdle microphone icon color.
backgroundstringCapsule shell chassis background.
borderColorstringHairline border stroke color.
sizenumberIdle height and width in pixels.
shape"pill" | "rounded"Capsule corner geometry style.
reachnumberAdditional extension buffer when expanded.
showTimebooleanWhether to show monospace elapsed clock (0:00).
waveformbooleanWhether to render dynamic canvas audio waveform.
slideToCancelbooleanEnables horizontal slide-to-cancel drag physics.
cancelDistancenumberPixel distance dragged left before triggering cancel.
attacknumberWaveform envelope attack time constant (ms).
releasenumberWaveform envelope release decay constant (ms).
sensitivitynumberAudio input gain multiplier.
floornumberMinimum visible waveform bar height ratio.
openDurationnumberExpansion transition duration in ms.
pressScalenumberScale transformation on pointer down.
mode"auto" | "hold" | "toggle"Trigger interaction mode.
holdAfternumberMilliseconds before tap transitions into a hold.
reactive"simulated" | "mic"Audio source: real microphone or simulated speech.
disabledbooleanDisables recording triggers.
ariaLabelstringAccessible label.
onStart(info: { source: "simulated" | "mic" }) => voidFired when voice recording starts.
onStop(info: { reason: string; duration: number }) => voidFired when voice recording terminates.
classNamestringAdditional styling classes.

MIT License. Free to use in personal and commercial projects. Built for Peel UI.