
Development
react-speech-recognition: Add Voice Input to React Apps
Editor | March 2, 2026 | 4 min read
react-speech-recognition is a React library that wraps the Web Speech API and exposes a clean hook-based API for voice-driven UI.
If your app needs speech-to-text input, command shortcuts, or accessibility-friendly interactions, this package gives you a fast starting point.
Package Snapshot
As of March 2, 2026, the npm package reports:
- latest version:
4.0.1 - license:
MIT - description: Speech recognition for your React app
- npm page: https://www.npmjs.com/package/react-speech-recognition
- repository: https://github.com/JamesBrill/react-speech-recognition
Install
npm install react-speech-recognition
Basic Usage
import React from "react"
import SpeechRecognition, { useSpeechRecognition } from "react-speech-recognition"
export default function Dictaphone() {
const { transcript, listening, resetTranscript, browserSupportsSpeechRecognition } =
useSpeechRecognition()
if (!browserSupportsSpeechRecognition) {
return <p>Your browser does not support speech recognition.</p>
}
return (
<div>
<p>Microphone: {listening ? "on" : "off"}</p>
<button onClick={() => SpeechRecognition.startListening()}>Start</button>
<button onClick={() => SpeechRecognition.stopListening()}>Stop</button>
<button onClick={resetTranscript}>Reset</button>
<p>{transcript}</p>
</div>
)
}
Practical Features You Will Use
transcript: current recognized speech textlistening: microphone active statestartListeningandstopListening: microphone controlresetTranscript: clear local transcript statecommands: phrase matching for voice actions
Production Notes
- Browser support for native Web Speech API is uneven, so test your real target devices.
- Use a polyfill strategy if your app needs broader cross-browser consistency.
- Handle microphone permission denial with clear fallback UI.
- Avoid auto-starting mic without user intent; require explicit interaction.
Final Take
react-speech-recognition is a practical choice when you want to add voice input quickly in React without building speech recognition plumbing from scratch.