Animation

Typewriter

Classic typewriter — types out a string char-by-char, optionally deletes it, then types the next string. Cycles through [texts] (or a single string) with a blinking cursor. Pure JS (no GSAP), pure CSS cursor blink.

Angular adaptation of an effect by David Haz / reactbits.dev.

Import

import { WrTypewriter } from 'ngwr/typewriter';

Playground

We design.
<wr-typewriter
  [texts]="['design.', 'ship.', 'iterate.']"
  [typingSpeed]="50"
  [deletingSpeed]="30"
  [pauseDuration]="2000"
  [loop]="true"
  cursorCharacter="|"
/>

Customize

Typing Speed (ms)
50 ms
Deleting Speed (ms)
30 ms
Pause (ms)
2000 ms
Loop
Cursor

API

NameDescriptionTypeDefault
text / textsA single string or an array to cycle.string | readonly string[]— (one of them required)
typingSpeedPer-char typing speed in ms.number50
initialDelayDelay before typing starts, in ms.number0
pauseDurationPause after typing complete, before deleting, in ms.number2000
deletingSpeedPer-char deletion speed in ms.number30
loopLoop back to the first string after the last.booleantrue
showCursorShow the cursor glyph.booleantrue
hideCursorWhileTypingHide the cursor while typing / deleting.booleanfalse
cursorCharacterCursor glyph.string'|'
cursorBlinkDurationCursor blink half-cycle in seconds.number0.5
textColorsCycle through these colours per string.readonly string[][]
variableSpeedRandomise typing speed per char between min and max.{ min: number; max: number }
reverseModeType each string backwards.booleanfalse
startOnVisibleStart only after the host enters the viewport.booleanfalse
(sentenceComplete)Emits { text, index } when a string finishes typing.EventEmitter