Introduction
react-text-to-speech is an easy-to-use React.js component that leverages the Web Speech API to convert text to speech.
Features
- Converts text to speech using the Web Speech API.
- Highlights words as they are read aloud. See:
- Provides an API for handling errors and events:
- Manages multiple speech instances:
- Fully customizable for various use cases:
- Overcomes the Web Speech API's text length limit, enabling infinite text input.
- Automatically stops speech instances when the component unmounts.
Installation
Install react-text-to-speech
using:
- npm
- yarn
- pnpm
- bun
npm install react-text-to-speech --save
yarn add react-text-to-speech
pnpm add react-text-to-speech
bun add react-text-to-speech
Usage
react-text-to-speech offers two main ways to integrate text-to-speech functionality into your React.js applications.