Join our Discord Community

React Typing Text

Typewriter effects that don't make you want to throw your computer. Realistic typing speeds with proper cursor timing that actually looks like someone typing, not a robot having a breakdown. Built with Motion, TypeScript, and shadcn/ui.

Trying to implement text animations?

Join our Discord community for help from other developers.


Ever seen a "typing" effect that types at 300 WPM like a caffeinated secretary? Most typewriter animations either go way too fast (unreadable) or painfully slow (watching grass grow). This component types at human speeds with realistic pauses, backspacing, and cursor behavior that actually looks like someone is typing.

Realistic typewriter effects with human timing

Text that types naturally with proper cursor blinking:

Loading component...

Built with TypeScript and shadcn/ui, using Motion for smooth cursor animations in React applications. Characters appear at readable speeds, the cursor blinks naturally, and you can cycle through multiple phrases with realistic erase-and-retype behavior.

Installation

npx shadcn@latest add https://www.shadcn.io/registry/typing-text.json
npx shadcn@latest add https://www.shadcn.io/registry/typing-text.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/typing-text.json
bunx shadcn@latest add https://www.shadcn.io/registry/typing-text.json

Usage

import { TypingText } from "@/components/text/typing-text";

<TypingText
  text={["Build faster", "Ship better", "Scale easier"]}
  duration={80}
  cursor={true}
  loop={true}
  holdDelay={2000}
/>;

Why most typing effects suck

Most developers just animate characters appearing with a fixed delay, like a broken printer. Real typing has variation—people don't type every letter at exactly the same speed. Some letters take longer (like reaching for 'p' after 'a'), and people pause at punctuation.

This React component uses realistic base timing (80-120ms per character, like actual human typing) with proper cursor behavior. The cursor blinks independently from typing, stops blinking while typing (like real terminals), and resumes after pauses. When cycling through text, it erases at a faster speed than typing (like backspacing), then starts the next phrase.

Most importantly, the timing is tuned for readability. Fast enough that users don't get bored, slow enough that they can follow along. No more robot typing or snail-pace reveals.

Features

  • Character-by-character typing with human-speed timing for React applications
  • Realistic cursor that blinks independently and stops during active typing
  • Multiple text cycling with backspace erase and natural transition delays
  • In-view detection so typing starts when users actually see the component
  • Complete TypeScript support with configurable timing and loop controls
  • Free open source component that works seamlessly with shadcn/ui themes
  • Optimized performance with proper cleanup for Next.js applications

API Reference

TypingText

Typewriter animation with realistic human timing and cursor behavior.

PropTypeDefaultDescription
textstring | string[]requiredText or array to type through
durationnumber100Milliseconds per character
delaynumber0Initial delay before typing starts
cursorbooleanfalseShow blinking cursor
cursorClassNamestring-Custom cursor styling
loopbooleanfalseCycle through text array
holdDelaynumber2000Pause before erasing (ms)
eraseDelaynumber50Speed of backspacing (ms)
inViewbooleanfalseOnly animate when visible
inViewMarginstring"0px"Viewport margin for trigger
inViewOncebooleantrueAnimate only once
animateOnChangebooleantrueReset on text prop change
classNamestring-Additional CSS classes
...propsHTMLAttributes<HTMLSpanElement>-Standard span attributes

Realistic Typing Speeds

Timing that matches human typing patterns:

SpeedDuration (ms)WPM EquivalentBest For
Slow150-20020-30 WPMDramatic reveals, code demos
Normal80-12040-60 WPMHeadlines, taglines
Fast50-8060-80 WPMQuick updates, notifications
Rapid20-5080+ WPMReal-time feeds, chat

Common gotchas

Typing feels robotic: Default 100ms works for most cases in React applications. Add slight randomization by varying duration ±20ms, or use different speeds for punctuation vs letters with TypeScript logic.

Cursor doesn't align properly: The cursor uses absolute positioning relative to text height in JavaScript applications. If using custom fonts, you might need to adjust cursor height or line positioning.

Text cycles too quickly: Default 2-second hold gives users time to read in Next.js projects. Longer text needs longer holds (3-4 seconds), shorter text can use 1-1.5 seconds for snappy cycles.

Animation starts before users see it: Always use inView={true} unless you want immediate typing on page load. Otherwise users miss the effect entirely.

Memory leaks with unmounting: The component cleans up timeouts automatically, but avoid rapidly mounting/unmounting typing components in React applications. Cache them or use conditional visibility instead.

Integration with other components

Perfect for hero sections in Card layouts or dynamic headings in Sheet overlays within React applications. Works great with Button components for call-to-action sequences in Next.js projects.

For terminal-style interfaces, combine with Code Block for command demonstrations or Badge for status updates. This free open source component pairs well with Progress for loading states and Avatar for chat interfaces, all with complete TypeScript integration.

Questions developers actually ask