npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-use-voice

v0.1.0

Published

A React hook for the Web Speech API — voice recognition made simple.

Readme

react-use-voice

A lightweight React hook for the Web Speech API — add voice recognition to any React app in seconds.

TypeScript-first · Zero runtime dependencies · Tree-shakeable ESM + CJS


Install

npm install react-use-voice

Peer dependency: react >=17

Quick Start

import { useVoice } from 'react-use-voice';

function Dictation() {
  const {
    transcript,
    interimTranscript,
    listening,
    supported,
    error,
    start,
    stop,
    reset,
  } = useVoice({ lang: 'en-US' });

  if (!supported) return <p>Your browser does not support speech recognition.</p>;

  return (
    <div>
      <p>{transcript}<em>{interimTranscript}</em></p>
      {error && <p style={{ color: 'red' }}>{error}</p>}
      <button onClick={listening ? stop : start}>
        {listening ? '⏹ Stop' : '🎤 Start'}
      </button>
      <button onClick={reset}>Reset</button>
    </div>
  );
}

Options

| Option | Type | Default | Description | |---|---|---|---| | lang | string | 'en-US' | BCP-47 language tag | | continuous | boolean | true | Keep recognising after each utterance | | interimResults | boolean | true | Emit partial results while the user is speaking | | onResult | (transcript: string) => void | — | Callback fired with each final transcript segment | | onError | (error: string) => void | — | Callback fired on recognition error | | onStart | () => void | — | Callback fired when recognition starts | | onEnd | () => void | — | Callback fired when recognition ends |

Return Value

| Property | Type | Description | |---|---|---| | transcript | string | Accumulated final transcript | | interimTranscript | string | Live partial result (resets after each final result) | | listening | boolean | Whether the recogniser is currently active | | supported | boolean | false when the browser doesn't support SpeechRecognition | | error | string \| null | Latest error message | | start | () => void | Start voice recognition | | stop | () => void | Stop voice recognition | | reset | () => void | Clear transcript, interimTranscript, and error |

Browser Support

The Web Speech API is supported in Chromium-based browsers (Chrome, Edge, Brave, Opera) and Safari 14.1+. Firefox does not support SpeechRecognition natively. The hook gracefully degrades by returning supported: false in unsupported browsers.

SSR Compatibility

All browser API access is guarded with typeof window !== 'undefined'. The hook is fully safe for server-side rendering (Next.js, Remix, etc.) — it will simply return supported: false during SSR.

License

MIT