Typewriter

A typewriter component that cycles through text with a synced flashing highlight animation.

Installation

pnpm dlx shadcn@latest add https://atlasui.dev/r/typewriter-html.json

Usage

Define a <p> tag with class typewriter in your HTML file.

<p class="typewriter"></p>

Define an array of strings in your script.js file.

const textArray = [
  "Building pixels with purpose",
  "Shipping faster than deadlines",
  "Deploy now, panic later!",
  "...",
];

Config

ConfigTypeDefaultDescription
letterDelaynumber0.025Delay between each letter (in seconds)
boxFadeDurationnumber0.125Duration of the box fade (in seconds)
textFadeOutDurationnumber0.25Duration of the text fade out (in seconds)
delayBetweennumber5500Delay between each text fade out (in ms)