Join our Discord Community

React Typing Text Animation

Advanced typewriter effect with variable speed, colored text, GSAP cursor animations. Perfect for React applications requiring realistic typing experiences.

Powered by

Trying to implement typing text animations?

Join our Discord community for help from other developers.


Most typing animations are predictable and mechanical—fixed speeds with basic cursors that don't feel natural. This component creates realistic typing experiences with variable speeds, smooth GSAP-powered cursor animations, multi-colored text support, and intersection observer triggers for performance optimization.

Advanced typewriter effects with variable speed and colors

Text that types with variable timing, colored sequences, and smooth cursor animations:

Loading component...

Built with TypeScript, GSAP, and Motion for React applications, featuring intersection observer triggers, variable typing speeds, and multi-colored text arrays. The cursor uses smooth GSAP animations and can be customized with both character and bar styles.

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={["Beautiful components for React", "Built with shadcn/ui", "Ship faster than ever!"]}
  typingSpeed={75}
  pauseDuration={1500}
  showCursor={true}
  cursorCharacter="|"
  className="text-4xl font-bold"
  textColors={['#3b82f6', '#8b5cf6', '#06b6d4']}
  variableSpeed={{ min: 50, max: 120 }}
/>

Why most typing effects feel mechanical

Most developers use fixed timing with basic cursors—predictable animations that don't capture the natural variation of human typing. Real typing has inconsistent speeds, color emphasis, and smooth cursor behavior that traditional components miss.

This React component uses variable speed ranges to simulate natural typing rhythms, GSAP for smooth cursor animations, and support for multi-colored text arrays. The intersection observer ensures animations trigger only when visible, while the flexible cursor system supports both character and bar styles.

The key insight: natural typing isn't uniform. When speed varies organically and colors emphasize different concepts, it creates more engaging and human-feeling text reveals that hold user attention.

Features

  • Variable speed typing with configurable min/max ranges for natural rhythm variation
  • GSAP-powered smooth cursor animations with customizable blinking duration and easing
  • Multi-colored text support with automatic color cycling for different text segments
  • Intersection observer integration for performance-optimized scroll-triggered animations
  • Flexible cursor system supporting both character (|, _, █) and bar styles
  • Reverse typing mode and sentence completion callbacks for advanced interactions
  • Complete TypeScript support with extensive prop customization options
  • Free open source component compatible with Next.js and shadcn/ui design systems

API Reference

TypingText

Advanced typewriter animation with variable speed, colors, and GSAP cursor animations.

PropTypeDefaultDescription
textstring | string[]requiredText or array to type through
typingSpeednumber50Base milliseconds per character
initialDelaynumber0Initial delay before typing starts
pauseDurationnumber2000Pause before erasing (ms)
deletingSpeednumber30Speed of backspacing (ms)
loopbooleantrueCycle through text array
showCursorbooleantrueShow blinking cursor
cursorCharacterstring | React.ReactNode"|"Cursor character or custom element
cursorClassNamestring-Custom cursor styling
cursorBlinkDurationnumber0.5GSAP cursor blink duration (s)
hideCursorWhileTypingbooleanfalseHide cursor during typing
textColorsstring[][]Colors for each text in array
variableSpeed{min: number, max: number}-Random speed range
startOnVisiblebooleanfalseStart only when in viewport
reverseModebooleanfalseType text in reverse
onSentenceComplete(sentence: string, index: number) => void-Callback when sentence finishes
asElementType'div'HTML element to render
classNamestring-Additional CSS classes

Cursor Character Options

Different cursor styles for various aesthetics:

CharacterStyleBest ForExample
"|"Thin bar (default)Modern, clean interfacescursorCharacter="|"
"_"UnderscoreRetro, terminal stylecursorCharacter="_"
"█"BlockBold, attention-grabbingcursorCharacter="█"
"▋"Half blockBalanced visibilitycursorCharacter="▋"
CustomAny character/emojiCreative, playfulcursorCharacter="🔥"

Variable Speed Configuration

Natural typing rhythm with randomized timing:

SettingConfigurationEffectBest For
ConsistenttypingSpeed={75}Fixed 75ms per charPredictable, professional
Subtle VariationvariableSpeed={{min: 60, max: 90}}±15ms varianceSlight humanization
NaturalvariableSpeed={{min: 40, max: 120}}±40ms varianceHuman-like rhythm
DramaticvariableSpeed={{min: 20, max: 200}}Wide varianceExpressive, artistic

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.

Questions developers actually ask