Voice Input
Voice input with waveform and transcript. Pro · AI chat and agents › Voice
Microphone button with a live waveform, for dictating into a composer. Toggle and push-to-talk modes, a transcript slot, Send / Cancel, and a clear blocked-microphone state with retry.
Installation
npx valyro-cli@latest login
npx valyro-cli@latest add voice-input
npm install valyro-ui-pro
import 'valyro-ui-pro/styles.css';
import { VoiceInput } from 'valyro-ui-pro';
Props
| Prop | Type | Default | |
|---|---|---|---|
mode | 'toggle' | 'push-to-talk' | 'toggle' | toggle: click to start, Send / Cancel to finish. push-to-talk: hold the button (or Space) and release to send. |
recording | boolean | Controlled recording; use with onRecordingChange. | |
defaultRecording | boolean | false | Initial recording when uncontrolled. |
onRecordingChange | (recording: boolean) => void | Called with the new recording when it changes. | |
microphone | boolean | true | Ask for the microphone when recording starts and meter it. Turn off to feed level yourself — from your own audio pipeline, or simulated as in a demo. |
level | AudioLevel | Input level, 0–1, when microphone is off; a function is polled every frame. | |
onStream | (stream: MediaStream | null) => void | Receives the microphone stream once granted (e.g. for a speech recognizer), and null when it stops. | |
transcript | ReactNode | Live transcript shown above the bar; set it from your speech-to-text results. | |
onSend | () => void | Finish and send: Send in toggle mode, releasing the button in push-to-talk. | |
onCancel | () => void | Throw the recording away: Cancel, or Escape. | |
permission | 'unknown' | 'granted' | 'denied' | 'unsupported' | Controlled permission; use with onPermissionChange. | |
defaultPermission | 'unknown' | 'granted' | 'denied' | 'unsupported' | 'unknown' | Initial permission when uncontrolled. |
onPermissionChange | (permission: VoicePermission) => void | Called with the new permission when it changes. | |
onError | (error: unknown) => void | A getUserMedia failure (denied, no device, in use). | |
disabled | boolean | false | Disables the mic and Retry buttons, so recording can't start. |
bars | number | 32 | Number of waveform bars. |
locale | string | BCP 47 locale for the timer digits; defaults to the ThemeProvider's. | |
labels | Partial<VoiceInputLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Related components
- Voice Orb — Animated voice-mode orb
- AI Chat Window — AI chat window
- Chat Message — Messages with streaming output
- Message Branches — Message versions and a conversation branch tree
- Streaming Text — Smooth token streaming
- Markdown Preview — Rendered Markdown
- Response Feedback — Answer rating and a rubric for reviewers
- Prompt Composer — Prompt field with attachments
- Inline Suggestion — Inline autocomplete suggestion
- Model Selector — AI model picker
- Model Comparison — Side-by-side answers from several models
- Prompt Library — Prompt library with variables
Previous: Voice Orb · Next: Token Usage · All AI chat and agents