Updated
Typewriter
Typing with a human hand
Customize
Key delay35ms
Key jitter70ms
Space pause90ms
Text size48px
Installation
npx shadcn@latest add https://uibrik.com/r/typewriter.jsonInstall the packages
npm install motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/typewriter/typewriter.tsx"use client"; import { cn } from "@/lib/utils"; import { motion } from "motion/react"; import { useEffect, useState } from "react"; // `play` counts presses of a card's Change button. 0 means the card has not // been pressed yet, so every effect renders its resting state without // animating on page load. export type EffectProps = { play: number }; // Size comes from --text-effect-size (default 1.25rem, i.e. text-xl), so a // preview can enlarge every effect without changing the installed default. const SIZE = "text-[length:var(--text-effect-size,1.25rem)] leading-[1.4]"; const TEXT = `${SIZE} text-zinc-700 font-medium dark:text-zinc-200`; /** 0.9 × the effect size (text-lg at the default). */ const SIZE_SM = "text-[length:calc(var(--text-effect-size,1.25rem)*0.9)] leading-[1.556]"; // 05 — Typing with a human hand: keystrokes arrive at uneven intervals, // spaces earn a short pause, and one typo is noticed and backspaced. type Keystroke = { type: "add"; ch: string } | { type: "del" } | { type: "wait"; ms: number };
Adds the files to
components/uibrik/typewriter and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/typewriter.Usage
import { Typewriter } from "@/components/uibrik/typewriter/typewriter";<Typewriter play={0} text="Typing with a human hand" keyDelay={35} keyJitter={70} spacePause={90}/>Where to use Typewriter
Typing headlines
Text typed with a human rhythm, mistakes included, feels authentic.
AI product intros
Typing suggests a model writing an answer.
Pairs with Streaming Chat
Code-themed sites
A typed line fits terminal and developer branding.
Pairs with Terminal Demo
Props
Typewriter- text
- Type string
- "Typing with a human hand"
- The copy to type. The scripted typo only plays for the default sentence.
- keyDelay
- Type number
- 35
- Shortest gap between keystrokes.
- keyJitter
- Type number
- 70
- Random extra per keystroke.
- spacePause
- Type number
- 90
- Extra pause after a space.
- playrequired
- Type number
- –
- Each change plays the effect again; 0 shows its resting state.