AI Chat Fancy Stable

VoiceInput

A mic button that opens into a recording panel: a live waveform painted from amplitude levels you supply, a stopwatch, the transcript as it arrives, and a cross and a check to throw it away or keep it

Preview

Installation

pnpm add fancy-ui-svelte
import { VoiceInput } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { VoiceInput } from 'fancy-ui-svelte';
</script>

<VoiceInput />

Examples

Basic Usage

Props

PropTypeDefaultDescription
active booleanfalseWhether a recording is in progress (bindable). Every button writes through it; setting it from outside opens or closes the panel without firing a callback
transcript string""Live text pushed by the consumer as their recogniser produces it, rendered muted under the waveform; a growing string grows in place
samples ArrayLike<number>-Amplitude levels in 0..1 bridged from your own audio pipeline, one entry per bar. The component never opens a microphone itself
demo booleanfalseDraw a deterministic synthetic wave when no samples arrive, so the panel is legible on a page with no audio behind it. Real samples always win
onStart () => void-Called when the mic button starts a recording
onStop () => void-Called when the check ends the recording and keeps the transcript
onCancel () => void-Called when the cross abandons the recording
height number48Waveform height in CSS pixels, clamped to 16..240
color stringvar(--ft-voice-color, currentColor)Any CSS colour for the bars, including a var() or currentColor — written onto the canvas as its CSS color and read back resolved, because a 2D context understands neither