Typing Text
MotionA React typewriter that types a phrase, holds, deletes and moves on, with a blinking accent caret. Starts in view and gives screen readers the plain text.
Installation
npx shadcn@latest add @minidev/typing-text
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/typing-text.json
Usage
import { TypingText } from "@/components/ui/typing-text"
export function Example() {
return (
<TypingText />
)
}
API reference
When to use
Use it for a short hero line that types a few phrases. Reach for WordRotate to swap one word in a sentence, MorphingText for a softer melt, and HeroTypedHeadline for a complete typed hero.
Accessibility
- Screen readers get all
phrasesjoined once from ansr-onlyspan; the typed text and caret arearia-hidden. - Typing only runs while 60% of it is in view.
- Under reduced motion it shows the first phrase in full and the caret does not blink.
Frequently asked questions
How do I type the phrases once and stop?
Pass loop={false}. It types each phrase, deletes it, and stops after the last one is typed, leaving it on screen. speed is milliseconds per character (55, with a little random jitter) and hold is how long a finished phrase stays (1400).
Will the typing move the text around it?
Yes. It is an inline-flex span whose width follows the typed text. Put it at the end of a line, or give it a fixed width, so nothing after it shifts.
Dependencies
npm
Built from
Examples
Custom phrases
phrases are typed, held, deleted and replaced in order; the loop restarts after the last one.
Type once
loop={false} types the last phrase and leaves it with the caret blinking; speed is milliseconds per character.
Inside a headline
Set the static words beside it and colour the typed slot with className; hold keeps each finished phrase on screen.