Text Typing - Smooth Typewriter Animation Component A smooth text typing animation component that cycles through an array of texts with typewriter effect. Features customizable cursor styles, typing/deleting speeds, infinite loop, and Framer Motion animations. Perfect for hero sections, portfolios, and dynamic content.
Installation
npx shadcn@latest add "https://ui-struct.vercel.app/r/text-typing"
Usage
Ts Js
import TextTyping from "@/components/ui/text-typing" ;
texts ={ [ 'Developer' , 'Designer' , 'Creator' ] }
Preview
Watch the text type and delete in a smooth infinite loop.
Cursor Styles
Three cursor styles to match your design aesthetic.
Cursor Style Description barClassic blinking vertical bar underscoreTerminal-style underscore blockBlock cursor like text editors
Typing Speed
Control how fast text types and deletes.
Speed Typing Deleting Use Case Fast 30ms 20ms Quick, energetic feel Normal 80ms 50ms Natural typing speed Slow 150ms 80ms Dramatic, deliberate Very Slow 250ms 100ms Cinematic effect
Hero Section
Perfect for portfolio and landing page hero sections.
Gradient & Neon Effects
Combine with CSS gradients and glow effects for stunning visuals.
Terminal Style
Classic terminal/command line aesthetic.
Chat Interface
Simulated chat typing effect.
Code Editor
Code editor style with syntax highlighting.
Component Showcase
Various use cases in different contexts.
Props
Prop Type Default Description textsstring[]- Array of texts to cycle through classNamestring''Additional CSS classes typingSpeednumber80Typing speed in milliseconds deletingSpeednumber50Deleting speed in milliseconds pauseDurationnumber1500Pause after typing completes (ms) cursorbooleantrueShow/hide cursor cursorStyle'bar' | 'underscore' | 'block''bar'Cursor style cursorColorstring'currentColor'Cursor color cursorBlinkSpeednumber0.8Cursor blink duration (seconds) loopbooleantrueLoop through texts infinitely onComplete() => void- Callback when loop finishes (if loop=false)
Examples
Basic Usage
Ts Js
< TextTyping texts ={ [ 'Hello' , 'World' ] } />
Custom Styling
Ts Js
< span className = "text-2xl font-bold" >
texts ={ [ 'Developer' , 'Designer' , 'Creator' ] }
className = "text-blue-500"
With Gradient Text
Ts Js
< span className = "text-transparent bg-clip-text bg-gradient-to-r from-purple-500 to-pink-500" >
texts ={ [ 'Amazing' , 'Beautiful' , 'Stunning' ] }
Terminal Style
Ts Js
< div className = "font-mono bg-black text-green-400 p-4" >
texts ={ [ 'npm install' , 'yarn add' , 'pnpm add' ] }
Without Loop
Ts Js
texts ={ [ 'Loading complete!' ] }
onComplete ={ () => console. log ( 'Done!' ) }
Keep the texts array reasonably sized
Avoid very fast typing speeds (< 20ms) on mobile
Use appropriate pauseDuration for readability
Full Code