{"id":15416721,"url":"https://github.com/bunlong/react-webspeech","last_synced_at":"2025-10-18T19:28:04.614Z","repository":{"id":57347659,"uuid":"279081977","full_name":"Bunlong/react-webspeech","owner":"Bunlong","description":"The official WebSpeech for React.","archived":false,"fork":false,"pushed_at":"2020-07-25T08:07:08.000Z","size":140,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T08:43:33.240Z","etag":null,"topics":["javascript","react","react-webspeech","speech-recognition","speech-synthesis","typescript","webspeech"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bunlong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-12T14:31:29.000Z","updated_at":"2023-09-29T02:01:55.000Z","dependencies_parsed_at":"2022-08-28T03:01:35.103Z","dependency_job_id":null,"html_url":"https://github.com/Bunlong/react-webspeech","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bunlong%2Freact-webspeech","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bunlong%2Freact-webspeech/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bunlong%2Freact-webspeech/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bunlong%2Freact-webspeech/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bunlong","download_url":"https://codeload.github.com/Bunlong/react-webspeech/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249715474,"owners_count":21315054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","react","react-webspeech","speech-recognition","speech-synthesis","typescript","webspeech"],"created_at":"2024-10-01T17:13:33.148Z","updated_at":"2025-10-18T19:27:59.573Z","avatar_url":"https://github.com/Bunlong.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  ⭐️ If you like react-webspeech, give it a star! ⭐️\n\u003c/p\u003e\n\n\u003cbr /\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/Bunlong/react-webspeech/blob/master/static/images/react-webspeech.png\" width=\"80%\" height=\"80%\" alt=\"react-webspeech\" /\u003e\n\u003c/p\u003e\n\n# react-webspeech\n\nreact-webspeech – Official WebSpeech for React.\n\n[![NPM](https://img.shields.io/npm/v/react-webspeech.svg)](https://www.npmjs.com/package/react-webspeech) [![downloads](https://img.shields.io/npm/dm/react-webspeech.svg?style=flat-square)](https://www.npmjs.com/package/react-webspeech) ![npm bundle size](https://img.shields.io/bundlephobia/min/react-webspeech) [![Build Status](https://api.travis-ci.com/Bunlong/react-webspeech.svg?branch=master)](https://travis-ci.com/Bunlong/react-webspeech) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Features\n\n* [x] Compatible with both JavaScript and TypeScript\n* [x] \u003ca href=\"#usespeechsynthesis\"\u003euseSpeechSynthesis (text-to-speech)\u003c/a\u003e – [Demo](https://fbv4x.csb.app/).\n* [ ] useSpeechRecognition (speech-to-text) – Coming in next version.\n\n## Install\n\nreact-webspeech is available on npm:\n\n```js\nnpm install react-webspeech --save\n```\n\nreact-webspeech is available on yarn as well:\n\n```js\nyarn add react-webspeech\n```\n\n## useSpeechSynthesis\n\n`useSpeechSynthesis` is a text-to-speech react hook.\n\n### Usage\n\n```jsx\nimport React, { useState } from 'react';\nimport { useSpeechSynthesis } from 'react-webspeech';\n\nfunction App() {\n  const [text, setText] = useState('I love React');\n  const { speak } = useSpeechSynthesis();\n\n  return (\n    \u003cdiv\u003e\n      \u003ctextarea\n        value={text}\n        onChange={(event) =\u003e setText(event.target.value)}\n      /\u003e\n      \u003cbutton onClick={() =\u003e speak({ text })}\u003eSpeak\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\n#### Prop\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eProp\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eRequire\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003cthead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eonEnd\u003c/td\u003e\n      \u003ctd\u003e() =\u003e void\u003c/td\u003e\n      \u003ctd\u003e❌\u003c/td\u003e\n      \u003ctd\u003eCalled when SpeechSynthesis has finished being spoken.\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n#### Return\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eReturn\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003cthead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eisSupported\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e if the browsers supports SpeechSynthesis otherwise \u003ccode\u003efalse\u003c/code\u003e.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eisSpeaking\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e if SpeechSynthesis is speaking otherwise \u003ccode\u003efalse\u003c/code\u003e.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evoices\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e\u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice\"\u003eSpeechSynthesisVoice\u003c/a\u003e[]\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eUse to get an array of \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice\"\u003eSpeechSynthesisVoice\u003c/a\u003e that is passed to the speak function.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003ecancel\u003c/td\u003e\n      \u003ctd\u003e(): void\u003c/td\u003e\n      \u003ctd\u003eCalled to stop reading.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003espeak\u003c/td\u003e\n      \u003ctd\u003e(\u003ca href=\"#speak-params\"\u003espeak Params\u003c/a\u003e): void\u003c/td\u003e\n      \u003ctd\u003eCalled to make SpeechSynthesis read the text.\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n#### speak Params\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eProp\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDefault\u003c/th\u003e\n      \u003cth\u003eRequire\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003cthead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003estring\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e\"\"\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e❌\u003c/td\u003e\n      \u003ctd\u003eThe text that will be read by SpeechSynthesis.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evoice\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice\"\u003eSpeechSynthesisVoice\u003c/a\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003espeechSynthesis.getVoices()[0]\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e❌\u003c/td\u003e\n      \u003ctd\u003eThe voice that will be used to speak.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003erate\u003c/td\u003e\n      \u003ctd\u003enumber\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e1\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e❌\u003c/td\u003e\n      \u003ctd\u003eThe speed at which SpeechSynthesis will be spoken at.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003epitch\u003c/td\u003e\n      \u003ctd\u003enumber\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e1\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e❌\u003c/td\u003e\n      \u003ctd\u003eThe pitch at which SpeechSynthesis will be spoken at.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evolume\u003c/td\u003e\n      \u003ctd\u003enumber\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e1\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e❌\u003c/td\u003e\n      \u003ctd\u003eThe volume that SpeechSynthesis will be spoken at.\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- ## useSpeechRecognition\n\n`useSpeechRecognition` is a speech-to-text react hook.\n\n### Usage\n\n```jsx\nimport React, { useState } from 'react';\nimport { useSpeechRecognition } from 'react-speech-kit';\n\nfunction App() {\n  const [text, setText] = useState('');\n  const { isListening, startListening, stopListening } = useSpeechRecognition({\n    onResult: (transcript) =\u003e {\n      setText(transcript);\n    },\n  });\n\n  return (\n    \u003c\u003e\n      \u003ctextarea\n        value={text}\n        onChange={(event) =\u003e setText(event.target.value)}\n      /\u003e\n      {isListening \u0026\u0026 \u003cp\u003eI'm listening\u003c/p\u003e}\n      \u003cbutton\n        onMouseDown={startListening}\n        onMouseUp={stopListening}\n      \u003e\n        Start Listening\n      \u003c/button\u003e\n    \u003c/\u003e\n  );\n}\n\nexport default App;\n```\n\n#### Prop\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eProp\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eRequire\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003cthead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eonResult\u003c/td\u003e\n      \u003ctd\u003e(transcript): string\u003c/td\u003e\n      \u003ctd\u003e❌\u003c/td\u003e\n      \u003ctd\u003eCalled to get the transcript.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eonEnd\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eonError\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n#### Return\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eReturn\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003cthead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eisSupported\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e if the browsers supports SpeechRecognition otherwise \u003ccode\u003efalse\u003c/code\u003e.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eisListening\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e if SpeechRecognition is listening otherwise \u003ccode\u003efalse\u003c/code\u003e.\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003estopListening\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003eCalled to make SpeechRecognition stop listening the input.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003estartListening\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003eCalled to make SpeechRecognition start listening the input.\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n#### startListening Params\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eProp\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDefault\u003c/th\u003e\n      \u003cth\u003eRequire\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003cthead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003elang\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003einterimResults\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003econtinuous\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003emaxAlternatives\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003egrammars\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e --\u003e\n\n## 💖 Wrap Up\n\nIf you think any of the `react-webspeech` can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.\n\n## 🌟 Contribution\n\nWe'd love to have your helping hand on contributions to `react-webspeech` by forking and sending a pull request!\n\nYour contributions are heartily ♡ welcome, recognized and appreciated. (✿◠‿◠)\n\nHow to contribute:\n\n- Open pull request with improvements\n- Discuss ideas in issues\n- Spread the word\n- Reach out with any feedback\n\n## ⚖️ License\n\nThe MIT License [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003c!-- https://github.com/mdn/web-speech-api/tree/master/speak-easy-synthesis --\u003e\n\u003c!-- https://mdn.github.io/web-speech-api/speak-easy-synthesis/ --\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbunlong%2Freact-webspeech","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbunlong%2Freact-webspeech","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbunlong%2Freact-webspeech/lists"}