Typewriter Effect

The Typewriter Effect component allows you to display text with a typewriter animation, either one by one or multiple at once. Ideal for presentations, headings, or attention-grabbing texts.

|

Install

pnpm dlx shadcn@latest add https://www.katestroyui.com/r/type-writer-effect

Usage

1import TypewriterEffect from "@/components/ui/type-writer-effect";
2
3export default function Demo() {
4 return (
5 <TypewriterEffect
6 texts={["Hello, world!", "Text animation with Typewriter Effect."]}
7 speed={80}
8 deleteSpeed={40}
9 delayBetween={1500}
10 loop
11 showCursor
12 cursorChar="|"
13 className="text-xl font-mono text-primary"
14 />
15 );
16}

Props

PropTypeDescriptionDefault
textstringTo display a single text.-
textsstring[]To display multiple texts sequentially.[]
speednumberTyping speed (ms).100
deleteSpeednumberDeletion speed (ms).50
delayBetweennumberTime between texts (ms).2000
loopbooleanTexts loop continuously.true
showCursorbooleanShould the cursor blink?true
cursorCharstringCursor character."|"
classNamestringExtra Tailwind/custom classes.-
onComplete() => voidCalled when animation is complete.-
onTextChange(currentText: string, index: number) => voidCalled on every text change.-
startDelaynumberDelay before animation starts (ms).0
preserveHeightbooleanShould height be preserved?false
randomSpeedbooleanShould speed be random for each character?false
pauseOnHoverbooleanShould animation pause on hover?false
enableCharBouncebooleanShould characters animate with bounce?true