Skip to Content
Kokonut UI

TX-01Texts

Typing Text

Typewriter text that makes the odd typo and corrects it, erases by selecting, and blinks its caret only when idle, built with React and Motion.

Install with
motion

PROKinetic Type Hero and more like it are in Kokonut UI Pro

Installation

Typing Text is a free, open-source React component in the Kokonut UI Texts collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/type-writer.tsx, so the code is yours to change.

npx shadcn@latest add @kokonutui/type-writer

Or add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/type-writer.tsx.

npm install motion

Usage

import TypewriterTitle from "@/components/kokonutui/type-writer";

export default function Example() {
  return <TypewriterTitle deleteMode="select" typos={0.06} />;
}

Props

sequences
TypewriterSequence[]Default built-in
typingSpeed
numberDefault 50
startDelay
numberDefault 200
autoLoop
booleanDefault true
loopDelay
numberDefault 1000
deleteSpeed
numberDefault 30
pauseBeforeDelete
numberDefault 1000
naturalVariance
booleanDefault true
deleteMode
"backspace" | "select"Default "backspace"

How a phrase is erased. "backspace" removes it one character at a time; "select" highlights it right to left, as with Shift+Home, then cuts it in one go.

typos
boolean | numberDefault false

Hit a neighbouring key now and then, pause, backspace and correct it. true is about a 4% chance per letter; a number sets the chance.

seed
numberDefault 7

Seed for the variance and typos, so every visit types the same way.

paused
booleanDefault false

Stops the typing where it is. Wire it to a pause control to let users stop the endless loop (WCAG 2.2.2). It also pauses while off screen.

as
TypewriterElementDefault "div"

Element to render, e.g. h1 when it is the page title.

className
string

Classes for the wrapper. Its width sets the font size.

textClassName
string

Classes for the text itself, e.g. to fix the font size.

TypewriterSequence

textrequired
string
deleteAfter
boolean
pauseAfter
number

TypewriterElement

type TypewriterElement = "div" | "p" | "span" | "h1" | "h2" | "h3";

Dependencies

NeedsVersionComes from
motion^12.23.25npm, installed by the CLI
cn from lib/utils.tsshadcn init
React19Your app
Tailwind CSS4Your app

No provider, font or global CSS to set up: the file works as soon as it lands.