Glass recorder preview

Glass recorder

A liquid-glass voice button for AI apps: tap the mic and it stretches into a pill with a running timer, a stop bubble and a colour glow inside the glass that swells with your voice. Opens the microphone and records the audio itself.

  • Group
    Chat
  • Origin
    Inspired · Original (this library)
  • License
    MIT
  • Added
    Oct 26
npx shadcn@latest add @deank/glass-recorder

The registry stays private. Install from the repo with a GitHub token — see the README.

Usage

import { GlassRecorder } from "@/registry/components/glass-recorder/glass-recorder";

<GlassRecorder />

Props

PropTypeDefaultDescription
recording?booleanControlled recording state. Leave it out to let the button manage itself.
defaultRecording?booleanfalseStart in the recording state (uncontrolled).
onRecordingChange?(recording: boolean) => voidCalled when the state changes, from a tap, Escape or maxDuration.
onComplete?(recording: GlassRecording) => voidCalled with the audio when a recording ends with the stop button or maxDuration. Escape discards instead.
onError?(error: unknown) => voidCalled when the microphone can't be opened (permission denied, no device, insecure page).
microphone?booleantrueOpen the microphone and record while active. Off: no permission prompt; the glow follows level or breathes on its own.
level?numberVoice level 0 to 1 from your own audio pipeline. Overrides the built-in meter.
maxDuration?numberStop on its own after this many seconds.
size?number56Height of the button in px. The pill is about four times as wide.
colors?string[]["oklch(72% .19 255)", "oklch(70% .22 320)", "oklch(80% .16 45)"]Two to four colours for the glow inside the glass.
tone?"smoke" | "clear""smoke"smoke is a darker glass that keeps the white timer readable on any page. clear is for colourful photos and gradients.
labels?{ start: string; stop: string }{ start: "Start recording", stop: "Stop recording" }Accessible names for the two states.

Also accepts every prop of Omit<HTMLAttributes<HTMLDivElement>, "onError">.

When to use

Voice input for a chat or agent composer, a dictation button in a notes app, a hold-to-talk control on a landing page or kiosk, anywhere the voice button should feel like the hero of the screen.

When not to use

Dense toolbars where a plain icon button fits better; long recordings that need pause, scrubbing or a waveform editor; playback of audio (use seek-bar).

Related

Prompt input · Liquid orb · Liquid glass card · Seek bar