Skip to content

Commit

Permalink
docs: update. (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney authored Dec 14, 2024
1 parent 867ffc6 commit b9dfb77
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@

Repository for `tts-react`, a React component and hook that uses the [`SpeechSynthesis`](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis) and [`SpeechSynthesisUtterance`](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance) API's to convert text to speech. You can fallback to the [`HTMLAudioElement`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio) API by providing a `fetchAudioData` prop to the hook or component.

> [!IMPORTANT]
> Requires a peer dependency of React and ReactDOM >= 19.
> Use `tts-react@3` if your project is on React 18.
## Install

`npm i react react-dom tts-react`
```console
npm i react react-dom tts-react
```

For projects using React 18:

```console
npm i react@18 react-dom@18 tts-react@3
```

## Table of Contents

Expand Down
16 changes: 12 additions & 4 deletions packages/tts-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ By default `tts-react` uses the [`SpeechSynthesis`](https://developer.mozilla.or

## Install

`npm i react react-dom tts-react`
```console
npm i react react-dom tts-react
```

For projects using React 18:

```console
npm i react@18 react-dom@18 tts-react@3
```

## Demo (Storybook)

Expand All @@ -34,9 +42,9 @@ Get up and running quickly using `tts-react` with ESM from a CDN. This example u
</head>
<body>
<script type="module">
import { createElement } from 'https://esm.sh/react@rc/?dev'
import { createRoot } from 'https://esm.sh/react-dom@rc/client?dev'
import { TextToSpeech } from 'https://esm.sh/tts-react@next?deps=react@rc&dev'
import { createElement } from 'https://esm.sh/react'
import { createRoot } from 'https://esm.sh/react-dom/client'
import { TextToSpeech } from 'https://esm.sh/tts-react'
import htm from 'https://esm.sh/htm'
const html = htm.bind(createElement)
Expand Down

0 comments on commit b9dfb77

Please sign in to comment.