react-auto-typer
v2.1.2
Published
An auto typer component for react.
Readme
react-auto-typer
A lightweight auto-typer React component.
Install
npm install --save react-auto-typerUsage
The package exports a named component AutoTyper.
import React from 'react'
import { AutoTyper } from 'react-auto-typer'
function Example() {
return (
<AutoTyper
text='Sample text here'
delay={100} // optional, defaults to 100
styleClass='autotyper' // optional CSS class applied to the <p>
repeat={false} // optional, whether to restart typing after completion
onlyOnce={false} // optional, if true, calls onComplete and stops
onComplete={() => console.log('typing complete')} // optional callback
/>
)
}Props
text(string, required): Text to auto type.delay(number, optional): Delay between typing steps in milliseconds. Defaults to100.styleClass(string, optional): CSS class applied to the wrapping<p>element.repeat(boolean, optional): Iftrue, typing restarts after reaching the end. Defaultfalse.onlyOnce(boolean, optional): Iftrue, the component will callonCompleteonce and stop the interval.onComplete(function, optional): Callback invoked once when typing completes (used whenonlyOnceis true).
Example
License
Apache-2.0 © trishantpahwa
