React Typing animate is an npm package use for typing animation
npm install react-typing-animate --save-dev
or
yarn add -D react-typing-animate
Add Typing
to your component:
import React from 'react'
import ReactDOM from 'react-dom/client'
import { Typing } from 'react-typing-animate'
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<React.StrictMode>
<div>
<h2>
Hi, i am a <Typing text={['software developer', 'writer']} speed={400} />
</h2>
</div>
</React.StrictMode>,
)
Syntax | Types | Default |
---|---|---|
text | string[] | [] |
speed | number | 500 |
cursor | string | "_" |
textClassName | string | |
cursorClassName | string | |
repeat | boolean | true |
this is an array of strings that your want to animate. e.g text={['hello', 'world']}
this is the speed at which you want to animate, 1000 represents 1 seconds. e.g speed={400}
this is a blinking cursor at the front of the text, it accepts onlt two strings, either an aunderstrike ( _ ) or a Pipe symbol ( | ). e.g cursor = '_' or cursor = '|'
this props is use to give the text a class name
this props is use to give the cursor a class name
this props is use to make the animation play once or repeat e.g repeat= {true}