Speech input

A React component in Beamline's Voice & audio category.

A text field you can speak into: the mic dictates through any speech-to-text provider, the phrase being heard shows apart from the finished words, and every failure (blocked, no microphone, connection lost and back) says what to do.

Use it for

  • Letting people speak instead of typing: notes, comments, a composer, a search.
  • Forms where long answers are easier said than typed.

Not for

Anatomy

  • label
  • field (text, multi- or single-line)
  • mic button (voice-button, icon only)
  • cancel (while listening)
  • listening strip: live level and the phrase being heard (opens under the field to its own height, closes the same way)
  • status line (reconnecting, microphone fallback)
  • failure with fix and retry
  • description

Variants

  • multiline: true, false
  • size: sm, md, lg

States

  • idle
  • asking for the microphone
  • connecting
  • listening (partial phrase in the strip)
  • reconnecting
  • finishing (last words)
  • error: blocked / no microphone / in use / connection / service
  • without a microphone (the provider runs on its own audio)
  • disabled

Keyboard

  • Tab reaches the field and the mic button
  • Enter or Space on the mic starts and stops
  • Escape while listening cancels and drops the phrase in progress
  • Typing in the field keeps working while dictating

Motion

The strip opens under the field to its own height over --pui-motion-in and closes over --pui-motion-out (.disclosure-panel, no measuring), so the text below glides; a failure or the microphone fallback grows in the same way. The level draws only while listening and on screen and settles to its baseline when the sound stops. Under reduced motion the strip opens and closes at once and the level becomes a number.

Props

PropTypeDefaultDescription
adapter (required)SpeechToText—Your speech-to-text provider, wired through the SpeechToText contract in
value / defaultValue / onValueChangestring—value: The text. Finished phrases are appended to it; the phrase being heard never is. defaultValue: Initial text, combining typing and completed dictation when uncontrolled. Defaults to an empty string. onValueChange: Reports text, combining typing and completed dictation after an edit; no callback by default.
label (required)ReactNode—Visible label or accessible name for the control. Required.
hideLabel / description / placeholderboolean / ReactNode / string—hideLabel: Hides the label; defaults to false. Deprecated: Use showLabel={false} instead. description: Supporting text beneath the label or heading. Defaults to no supporting text. placeholder: Text shown before a value is entered or selected. Defaults to no placeholder.
multilinebooleantrueA text area (default) or a single line.
rowsnumber3Visible text rows in the dictation field. Defaults to 3.
languagestring—BCP 47 language, passed to the adapter.
microphoneMicrophone—Share the input choice and mute with a MicSelector.
shortcutstring[]—A page-wide key to start and stop dictating.
onPartial / onFinal(text: string) => void—onPartial: Receives interim transcribed words that may still change; no handler by default. onFinal: Receives a completed transcription segment; no handler by default.
onError(error: VoiceError) => void—Receives a reported capture, playback or provider error; no handler by default.
size / disabled / name / id"sm" | "md" | "lg" / boolean / string / string—size: Control size within the supported size steps. Defaults to "md". disabled: Prevents interaction with the control. Defaults to false. name: Field name used in native form submission. Defaults to no form field name. id: DOM id used to connect the control and its label. Defaults to an automatically generated control id.
classNamesSpeechInputClassNames—Classes for the named visual parts; no part overrides by default.
style / refCSSProperties / Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the native input; no ref by default.
showLabelbooleantrueShows the label visually while keeping its accessible name; defaults to true. Takes precedence over hideLabel.
valuestring—The text. Finished phrases are appended to it; the phrase being heard never is.
defaultValuestring—Initial text, combining typing and completed dictation when uncontrolled. Defaults to an empty string.
onValueChange((value: string) => void)—Reports text, combining typing and completed dictation after an edit; no callback by default.
hideLabelboolean—Hides the label; defaults to false. Deprecated: Use showLabel={false} instead.
descriptionReactNode—Supporting text beneath the label or heading. Defaults to no supporting text.
placeholderstring—Text shown before a value is entered or selected. Defaults to no placeholder.
onPartial((text: string) => void)—Receives interim transcribed words that may still change; no handler by default.
onFinal((text: string) => void)—Receives a completed transcription segment; no handler by default.
sizeFieldSize—Control size within the supported size steps. Defaults to "md".
disabledboolean—Prevents interaction with the control. Defaults to false.
namestring—Field name used in native form submission. Defaults to no form field name.
idstring—DOM id used to connect the control and its label. Defaults to an automatically generated control id.
classNamestring—Classes on the documented visual root; no override by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLInputElement | HTMLTextAreaElement>—Receives the native input; no ref by default.

Built from

Dependencies

lucide-react

Import

import { SpeechInput } from "@beamline/speech-input";

Get it

Speech input is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent

More in Voice & audio

  • Recorded answer: A spoken answer against a time limit: record (the microphone asked for first, a blocked one said with what to do), the running time against the limit…
  • Orb: The agent's presence: a thin ring of light around a lens in the brand's hue that holds still at rest, sends an arc round while thinking and widens with…
  • Call grid: The people on a video call, laid out for the room they are given: tiles as large as the space allows at the camera's shape, or the person talking (or a…
  • Bar visualizer: A row of bars that says what a voice agent is doing: a sweep while connecting, the person's voice while listening, a slow breath while thinking, the…
  • Matrix: A dot-matrix display: animated frame sets (loading, pulse, wave, syncing), text and digits in a 5×7 font, or a VU meter of levels or a live source. One…
  • Transcript viewer: A recording and its words together: the spoken word lights up as it plays and the transcript follows it, any word or paragraph time plays from there…
  • Waveform: The shape of a recording: one bar per slice of loudness, fitted to any width, with the played part in the accent, unmeasured slices hatched and a loading…
  • Live waveform: Loudness drawn as it happens: a scrolling history of the microphone (or any live source) or its spectrum, a calm processing state while words are…
  • Conversation bar: The control bar of a voice call with an agent: one button to call and hang up, the agent's state as bars, a call timer, mute, and typing when talking is…
  • Audio player: One audio element and its controls: play with a loading state, a scrub bar with time, skip, speed and a playlist whose rows play into the same player…
  • Voice button: The control that starts and stops talking: click to toggle or hold to talk (pointer, Space, Enter or a global shortcut), with a live level while…
  • Scrub bar: A seekable timeline for audio or video: elapsed and total time, what has loaded, chapter marks, a time preview under the pointer, and the full keyboard…
  • Voice picker: Choose a text-to-speech voice from a searchable list (name, accent, tone, use) and hear it first: each voice has its own orb, previews play one at a time…
  • Microphone selector: Choose the microphone, test it with a live level and mute it, with every permission and device state spelled out: not yet allowed, blocked (and how to…

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.