LiveCaptions

Words light up as they are spoken: said ones settle back, the current one is solid, the rest wait faintly. AI.

Open playground

About

LiveCaptions is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { LiveCaptions } from "@ashutoshswamy/smoui" and set text, wordsPerSecond, autoPlay among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { LiveCaptions } from "@ashutoshswamy/smoui";

<LiveCaptions text={transcript} wordsPerSecond={3} loop={false} onEnd={done} />

Props 5

text

The whole transcript.

string
wordsPerSecond

Reading speed. Default 3.

number
autoPlay

Start immediately. Default true.

boolean
loop

Start over at the end. Default true.

boolean
onEnd

The last word was reached (when not looping).

() => void