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
- Text-to-speech functionality
- Easy to use
- Highlights words as they are read (see highlighting text using useSpeech Hook and Speech Component).
- Provides API to handle errors and events (see Handling Errors and Events).
- Handles multiple speech instances easily (see handling using useSpeech Hook and Speech Component).
- Fully Customizable (see useSpeech Hook Usage and usage with FaC).
- Overcomes the Web Speech API's text limit, allowing for infinite text input.
- Automatically stops speech instances on component unmount.
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.