React component for creating customizable typewriting visualizations
import { Typewriting } from 'react-typewriting'
interface TypewritingRenderArgs {
currentText: string
fullCurrentText: string
}
<Typewriting
strings={[
'Sign up today!',
'Receive 20% off on your first purchase!',
]}
>
{({ currentText, fullCurrentText }: TypewritingRenderArgs) => (
<h1 aria-label={fullCurrentText}>{currentText}</h1>
)}
</Typewriting>$ npm install react-typewriting
# or
$ yarn add react-typewritingThe strings to print out, in order of appearance.
The child render prop.
currentTextholds the latest, sliced, version of the current stringfullCurrentTextholds the full value of the current string
Amount of milliseconds strings will be fully readable before starting to delete the string.
This prop controls the speed at which the strings are built.
If provided a number, this number will be the longest time to wait between writing characters.
If provided a [number, number] tuple, a number between these two values will be the longest time to wait between writing characters.
Same as writeSpeedMs (see above), but for when deleting characters.
Licensed under the MIT license.
William Boman [email protected]