2.0.5 • Published 5 years ago
react-typing-effect v2.0.5
React Typing Effect
This is a UI component built completely in React that simulates typing effect, eraser effect and a blinking cursor.
Demo

Getting Started
$ npm install --save react-typing-effect
ReactTypingEffect is the main component.
Example Usage:
import React from 'react';
import ReactTypingEffect from 'react-typing-effect';
const ReactTypingEffectDemo = () => {
return (
<>
<ReactTypingEffect
text={["Hello.", "World!"]}
/>
<br />
<ReactTypingEffect
text={["Hello.", "World!!!"]}
cursorRenderer={cursor => <h1>{cursor}</h1>}
displayTextRenderer={(text, i) => {
return (
<h1>
{text.split('').map((char, i) => {
const key = `${i}`;
return (
<span
key={key}
style={i%2 === 0 ? { color: 'magenta'} : {}}
>{char}</span>
);
})}
</h1>
);
}}
/>
</>
);
};Motivation
Inspired by this blog post http://burnmind.com/tutorials/how-to-create-a-typing-effect-an-eraser-effect-and-a-blinking-cursor-using-jquery
API
Required Props
text: That text that will be typed and erased. Can be either anarrayof strings or just astring.
Other Props
displayTextRenderer:func.(displayText: string, textIndex: number) => elementIftextpropType isarray, thentextIndexwill be thearray indexof the text, otherwisetextIndexwill be equal to0.staticText:String. Text that will just be static and cannot be typed or erased.className:Stringspeed:Number. default500ms. Typing speed.eraseSpeed:Number. default500ms. Erase speed.eraseDelay:Number. default5000ms. Time to wait before erasing the text.typingDelay:Number. default2500ms. Time to wait before starting to type.cursor:String. Default:|cursorClassName:String