Skip to content

Typing Text

Motion

A 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.

src/registry/premium/typing-text.tsx/r/typing-text.json

Installation

bash
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

tsx
import { TypingText } from "@/components/ui/typing-text"

export function Example() {
  return (
    <TypingText />
  )
}

API reference

TypingText props
PropTypeDefault
phrasesstring[]["Build the MVP.", "Ship it in 30 day...
speedMilliseconds per typed character.number55
holdMilliseconds to hold a finished phrase.number1400
loopbooleantrue
classNamestring-

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 phrases joined once from an sr-only span; the typed text and caret are aria-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

motion

Built from

No other MiniDev files

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.

All Animated React components