Components / Text
Typewriter
Types and deletes a list of words on a loop, with a blinking cursor.
Build beautiful landing pages., dashboards., portfolios., side projects.
Installation
Requires React 18+ and Tailwind CSS.
- 1
Install dependencies
$ npm install motion - 2
Add the component
Copy the code from the Code tab above into
components/ui/typewriter.tsx. - 3
Use it
example.tsximport { Typewriter } from "@/components/ui/typewriter"; const words = ["landing pages.", "dashboards.", "portfolios.", "side projects."]; export default function TypewriterDemo() { return ( <p className="text-center text-2xl font-semibold text-zinc-900 dark:text-white sm:text-3xl"> Build beautiful{" "} <Typewriter words={words} className="text-orange-400" /> </p> ); }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| words | string[] | — | Words or phrases to cycle through. |
| typingSpeed | number | 70 | Milliseconds per typed character. |
| deletingSpeed | number | 40 | Milliseconds per deleted character. |
| pause | number | 1400 | Milliseconds to hold a finished word. |