Plays a scripted typing sequence — type, pause, delete, rewrite — for product demos and heroes. Screen readers and the server get the final text only, the height is reserved so nothing jumps, a button plays, pauses and replays, and reduced motion shows the final text.
Rewrite
Can we move the review to Thursday at 10:00? I'll send the notes by Wednesday.
Installation
The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";
Usage
import { TypingDemo } from "@vamos-ui/react";
<TypingDemo
steps={[
"Hi all, I was wondering if maybe we could",
{ type: "pause", duration: 800 },
{ type: "replace", text: "Can we move the review to Thursday?" },
]}
/>The text is static demo copy, not a live stream; for real model output render the text as it arrives.
Fresh mounts above the fold start blank and type in; with autoPlay={false} the final text is there from the first paint.
Examples
Looping hero phrase
loop with replace steps; the pause control stays (WCAG 2.2.2).
Play on demand
autoPlay={false} shows the final text until Replay; set swaps text instantly.
npm install @vamos-ui/react + added 1 package
API
TypingDemo
| Prop | Type | Default |
|---|---|---|
stepsStrings (typed), or { type: "type" | "delete" | "replace" | "pause" | "set", … }. replace erases everything, then types. | TypingStep[] | — |
speedMilliseconds per character (a beat longer after punctuation, quicker over spaces). | number | 35 |
autoPlayStart when a third is visible, on mount, or only on Play (showing the final text until then). | boolean | "in-view" | "in-view" |
startDelayDelay before an automatic start. | number | 400 |
loop / loopDelayStart over after a hold on the final text. | boolean / number | false / 2400 |
controlsPlay / pause / replay button. | boolean | true |
cursorCaret while typing. | boolean | true |
asElement for the text. | "p" | "div" | "span" | "pre" | "p" |
textClassNameClasses for the text element (size, font, colour). | string | — |
onCompleteEach time the script reaches its end. | () => void | — |
labelsDictionary namespace "typingDemo": play, pause, replay. | Partial<TypingDemoLabels> | — |
typingFrames(steps, speed?) / typingFinalText(steps)
| Prop | Type | Default |
|---|---|---|
returnsThe keystroke frames, or the text the script ends on — for custom players and tests. | { text, delay }[] / string | — |