Skip to main content
Back to development
#Accessibility#React#React Native#Text-to-Speech#Open Source

Read-Aloud With Word Highlighting: Making Your App More Accessible With audio-reader-highlight

A practical guide to adding read-aloud with word-by-word highlighting to web, React and React Native apps with my free, open-source npm package, plus the accessibility details that make it genuinely helpful.

November 2026
9 min read

Why Read-Aloud Belongs in Your App

I first built audio-reader-highlight so the stories on able-hearts.org, a small family charity I support, could be listened to as well as read. It started as one feature for one site. Today it's a free, MIT-licensed npm package that reads any text aloud and highlights the exact word being spoken, on the web, in React, and in React Native and Expo apps.

Read-aloud with synced highlighting sounds like a nice-to-have until you watch someone use it. It helps a lot of different people:

  • Low vision. Listening takes the strain off, and the moving highlight makes it easy to find your place again when you glance back at the screen.
  • Dyslexia and other reading differences. Hearing a word while seeing it lit up links the sound to the spelling. Many readers find that easier than decoding a dense paragraph alone.
  • Language learners. Following the highlight is a gentle way to learn how written words are pronounced, at a speed you choose.
  • Busy eyes. Someone cooking, commuting, or just tired after a day of screens can listen to your content instead of skipping it.

The polished versions of this feature usually sit behind paid services. I don't think the people who need a reader most should have to pay extra for one, so the package is free and always will be: no paid tier, no feature behind a key.


What You Get

  • Word-exact highlighting. The voice's own word timing when it reports it, and a self-calibrating estimate when it doesn't (Chrome's online voices, most Android voices).
  • Nothing is wrapped or rewritten. The DOM reader reads text straight from your page and paints it with the CSS Custom Highlight API, so your markup, React tree and layout stay exactly as they are.
  • Click or tap any word to start reading from there.
  • Reliable transport. Play, pause, resume, skip and stop behave the same on desktop and mobile.
  • No dependencies. The core works with any framework. React bindings, a React Native entry and a themeable stylesheet are included.

You can try all of it in the live demo before writing a line of code.


Quick Start: Plain Web (Any Framework)

npm install audio-reader-highlight

The core export is getReader(), which returns one shared reader for the page. Register an element as a readable region, then drive it:

import { getReader } from 'audio-reader-highlight';
import 'audio-reader-highlight/styles.css';

const reader = getReader();
const article = document.querySelector<HTMLElement>('article');

if (article) {
  // register() returns a function that unregisters the region.
  const unregister = reader.register('post', article, { label: 'My post' });

  document.querySelector('#listen')?.addEventListener('click', () => {
    reader.toggle('post'); // play, pause or resume this region
  });

  reader.subscribe(state => {
    console.log(state.status, state.word, state.progress);
  });

  // Later, e.g. on route change:
  // unregister();
}

The rest of the transport is just as small: reader.play('post'), reader.pause(), reader.resume(), reader.skip(1) for the next sentence (-1 goes back), and reader.stop().

Anything that shouldn't be read aloud, such as a share bar or a code sample, can be marked with data-tts-skip. Elements with aria-hidden="true" are skipped too.


Quick Start: React

The React entry gives you three components and a hook. Readable marks a region, ListenButton plays and pauses it, and PlayerDock is a floating player with skip, speed and voice controls.

import { Readable, PlayerDock, ListenButton } from 'audio-reader-highlight/react';
import 'audio-reader-highlight/styles.css';

export default function Post() {
  return (
    <>
      <Readable id="post" label="My post">
        <h1>Title</h1>
        <p>Body text…</p>
      </Readable>

      <ListenButton region="post">Listen</ListenButton>
      <PlayerDock defaultRegion="post" />
    </>
  );
}

The components are marked 'use client', so they drop straight into a Next.js App Router page. If you'd rather build your own controls, useReader() gives you { reader, state }. Note that reader is null during server rendering, hence the optional chaining:

'use client';
import { useReader } from 'audio-reader-highlight/react';

export function ReadButton({ region }: { region: string }) {
  const { reader, state } = useReader();
  const playing = state.region === region && state.status === 'playing';

  if (!state.supported) return null; // no speech synthesis on this device

  return (
    <button type="button" aria-pressed={playing} onClick={() => reader?.toggle(region)}>
      {playing ? 'Pause' : 'Listen'}
    </button>
  );
}

Quick Start: React Native and Expo

audio-reader-highlight/native brings the same reader to iOS and Android through the platform's own text-to-speech. It has no DOM and no native code of its own, so it works in Expo Go.

npx expo install expo-speech
npm install audio-reader-highlight

You pass it plain strings (one per paragraph, or "block") and it tells you which word is being spoken. highlightParts() splits a block into pieces you can style:

import * as Speech from 'expo-speech';
import { Text, Pressable } from 'react-native';
import {
  expoSpeechEngine,
  highlightParts,
  useNativeReader,
} from 'audio-reader-highlight/native';

const engine = expoSpeechEngine(Speech);

export function Story({ paragraphs }: { paragraphs: string[] }) {
  const { reader, state } = useNativeReader(engine, paragraphs);
  return (
    <>
      {paragraphs.map((text, i) => (
        <Text key={i}>
          {highlightParts(text, state.word?.block === i ? state.word : null).map((part, k) => (
            <Text key={k} style={part.active ? { backgroundColor: '#dfe3ff' } : undefined}>
              {part.text}
            </Text>
          ))}
        </Text>
      ))}
      <Pressable accessibilityRole="button" onPress={() => reader.toggle()}>
        <Text>{state.status === 'playing' ? 'Pause' : 'Listen'}</Text>
      </Pressable>
    </>
  );
}

state.sync tells you whether the timing comes from the voice's boundary events ('boundary', on iOS and the web) or from the calibrated estimate ('estimated', on most Android voices).

The native reader also has announce(), which is how the Tolimea app gives spoken roadside guidance. A prompt cuts in, then the reader carries on from the word it interrupted. Pass { interrupt: false } to wait for the end of the sentence. With nothing loaded, prompts simply queue, which suits navigation:

reader.announce('In 300 m, turn left.');
// Spoken as "In 300 meters, turn left."

The Speech Normaliser: Reading Like a Person

Speech engines are surprisingly bad at the text we actually write. Feed one 45 °C or $2.5k and you'll often hear symbols read out literally, or skipped. The package runs every sentence through a normaliser first, so numbers, currencies, units, abbreviations and science are read the way a person would read them.

It has no DOM dependency, so you can use it on its own, on a server, or with any speech engine:

import { buildSpeechFromSegment } from 'audio-reader-highlight';

buildSpeechFromSegment('Water is H₂O; 1.6 × 10⁻¹⁹ C.').speech;
// "Water is H 2 O; 1.6 times ten to the power of minus 19 coulombs."

buildSpeechFromSegment('Bake at 180 °C for 25 min.').speech;
// "Bake at 180 degrees Celsius for 25 minutes."

buildSpeechFromSegment('It weighs 3 kg and costs €12.99.').speech;
// "It weighs 3 kilograms and costs 12.99 euros."

buildSpeechFromSegment('Tickets from $2.5k. Speed limit 50 km/h.').speech;
// "Tickets from 2.5 thousand us dollars. Speed limit 50 kilometers per hour."

buildSpeechFromSegment('Dr. Wanjiru arrives at 9:30 a.m., e.g. before the rain.').speech;
// "Doctor Wanjiru arrives at 9:30 AM, for example before the rain."

Those outputs come from running the current release, not from memory. The result also carries a map from each spoken character back to the source characters it came from. That map is what lets the highlight land on °C in your text while the voice is saying "degrees Celsius". The sentence splitter, splitSentences(), knows about abbreviations too, so Dr. and e.g. don't end a sentence early.


Pause and Resume, Even on Android

This was the hardest part to get right, and the part people notice most when it's wrong. The browser's own speechSynthesis.pause() is unreliable on Android and with network voices, and on React Native expo-speech can't pause on Android at all.

So the reader never relies on the platform's pause. It remembers the word it was on, stops the speech, and on resume starts a fresh utterance from that exact word. The highlight stays exact, and the listener hears the sentence pick up where they left it instead of jumping back to the start of the paragraph. The same trick means a change of speed or voice applies from the current word:

reader.pause();
reader.resume(); // carries on from the word that was being spoken

reader.configure({ rate: 1.25 }); // applies from the current word, no restart

Accessibility Tips When You Ship It

A reader is an accessibility feature, so it's worth getting the details around it right too. Here's what I do in my own apps:

  1. Never autoplay. Speech that starts on its own talks over screen readers and startles everyone else. Let the user press Listen. Many browsers won't start speech without a user gesture anyway.
  2. Respect reduced motion. The stylesheet already drops its animations under prefers-reduced-motion: reduce. The reader also smooth-scrolls to keep the spoken word in view, and you can turn that off for people who asked for less motion:
if (matchMedia('(prefers-reduced-motion: reduce)').matches) {
  getReader().configure({ follow: false });
}
  1. Use real buttons and keep focus where it is. ListenButton is a <button> with aria-pressed, and starting playback doesn't move focus. If you build your own control, keep it a button. PlayerDock adds keyboard shortcuts (Space to play or pause, arrow keys to skip sentences, Escape to stop) that stay out of the way when focus is in an input, link or button.
  2. Use aria-live sparingly. The dock announces its status ("Ready to read", "paused", sentence counts) in a polite live region, and the fast-changing current word is aria-hidden. Don't put the spoken word itself in a live region: a screen reader would try to read every word on top of the voice.
  3. Let users pick their voice and speed. The right voice and pace differ from person to person. state.voices lists what the device offers and configure() saves the choice for next time:
'use client';
import { useReader } from 'audio-reader-highlight/react';

export function VoiceSettings() {
  const { reader, state } = useReader();
  return (
    <>
      <label>
        Voice
        <select
          value={state.settings.voiceURI}
          onChange={e => reader?.configure({ voiceURI: e.target.value })}
        >
          {state.voices.map(v => (
            <option key={v.voiceURI} value={v.voiceURI}>
              {v.name} ({v.lang})
            </option>
          ))}
        </select>
      </label>
      <label>
        Speed
        <select
          value={state.settings.rate}
          onChange={e => reader?.configure({ rate: Number(e.target.value) })}
        >
          {[0.75, 1, 1.25, 1.5, 2].map(r => (
            <option key={r} value={r}>
              {r}×
            </option>
          ))}
        </select>
      </label>
    </>
  );
}
  1. Handle "not supported" gracefully. Check state.supported and hide your own Listen button when the device has no speech synthesis. PlayerDock already shows a short status message in that case.
  2. Skip the noise. Put data-tts-skip on navigation, share bars, captions you don't want read, and anything decorative.

Where It Runs Today

audio-reader-highlight isn't a demo-only project. It reads blog posts aloud on able-hearts.org and in the AbleHearts app, and it gives spoken roadside guidance in the Tolimea app. Those three cover a static web page, a React Native reading screen, and voice prompts while someone is driving, which is a good spread of the ways people actually listen.

There's more on how it was built on the audio-reader-highlight product page.


Try It, Star It, Tell Me What Breaks

If you're working on accessibility in your own product, whether that's read-aloud, voice guidance or a wider review of how inclusive your web or mobile app is, I'd be glad to help. Book a free 30-minute discovery call and tell me what you're building.

if (helpful) {

}

Found this useful? Follow me on GitHub · Hire me for your project

Read-Aloud With Word Highlighting: Making Your App More Accessible With audio-reader-highlight | hesbon.dev