Typing Text

Text typed character by character with a blinking caret.

typing-text.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/typing-text.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/typing-text.json

3

Turn on the motion

npx @prequelui/cli@latest animate typing-text

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

typing-text.tsx
import { TypingText, TypingTextCursor } from "@/components/prequelui/typing-text";

export default function Demo() {
  return (
    <p className="text-2xl font-medium">
      <TypingText
        text="Motion that feels right."
        duration={100}
        holdDelay={1000}
        loop
      >
        <TypingTextCursor />
      </TypingText>
    </p>
  );
}
import { TypingText } from "@/components/prequelui/typing-text";

export function Variant() {
  return (
    <TypingText tempo={1.2}>
      …
    </TypingText>
  );
}

Animation

The text is written into the DOM one character at a time, held, then erased at a faster rate before the next string begins. The caret is a separate part: it stays solid while typing and blinks while the text is idle.

  • Typing: 100 ms per character by default; erasing: 55 ms.
  • Hold delay: 1 s, doubled as the pause between strings when looping.
  • Caret blink: 1 s linear with a square duty cycle.
  • Reduced motion writes the full string immediately with no blink.
100 ms / charerase 55 mshold 1 scaret 1 s

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

TypingText

PropTypeDefault
textstring | string[]—
durationnumber100
delaynumber0
holdDelaynumber1000
loopbooleanfalse
inViewbooleanfalse

TypingTextCursor

PropTypeDefault
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026