Transcript
Speech as text: lines by speaker that follow the newest, with words still being guessed shimmering until they settle.
Installation
npx shadcn@latest add "@aiellie/transcript"shadcn needs the @aiellie registry in components.json first. npx aiellie add transcript adds it on its first run, then installs the same way.
Transcript shows speech as it becomes text. Each TranscriptSegment is a line, with the speaker's name before it. A line the recogniser is still guessing at is interim: it shimmers in muted ink until it settles, and screen readers skip it until then, so they never read out words that change.
The log keeps the newest line in view while you're at the bottom, and stays where you are once you scroll up to reread.
Getting started
Render the lines
Mark the line still being heard as
interim, and drop the mark when the recogniser commits to it.components/call-transcript.tsximport { Transcript, TranscriptSegment, } from "@/components/aiellie/transcript" type Line = { id: string; speaker: string; text: string; final: boolean } export function CallTranscript({ lines }: { lines: Line[] }) { return ( <Transcript> {lines.map((line) => ( <TranscriptSegment key={line.id} speaker={line.speaker} interim={!line.final} > {line.text} </TranscriptSegment> ))} </Transcript> ) }
Anatomy
<div data-slot="transcript" role="log" aria-live="polite">
<p data-slot="transcript-segment" data-interim>
<span data-slot="transcript-speaker" />
<span /> {/* the words */}
</p>
</div>It's a polite live region, so finished lines are read out without interrupting. It's 256px tall at most and scrolls inside itself. Set your own height with className.
The shimmer comes from shadcn's tailwind.css, and stops under reduced motion.
Examples
Dictation
Leave out speaker for a single voice.
Remind me to send the invoice on Friday.
API reference
Transcript
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | The segments. |
All other div props are forwarded.
TranscriptSegment
| Prop | Type | Default | Description |
|---|---|---|---|
speaker | string | Who said it. | |
interim | boolean | false | Still a guess: it shimmers, and screen readers skip it. |
All other p props are forwarded.