Installations
npm install react-effect-typewriter
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
20.10.0
NPM Version
10.5.0
Score
53.1
Supply Chain
87.6
Quality
82
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (90.28%)
CSS (5.24%)
JavaScript (2.31%)
HTML (2.17%)
Developer
Download Statistics
Total Downloads
1,842
Last Day
6
Last Week
75
Last Month
345
Last Year
1,842
GitHub Statistics
1 Stars
39 Commits
1 Watching
2 Branches
1 Contributors
Package Meta Information
Latest Version
1.0.2
Package Id
react-effect-typewriter@1.0.2
Unpacked Size
14.72 kB
Size
5.64 kB
File Count
12
NPM Version
10.5.0
Node Version
20.10.0
Publised On
03 May 2024
Total Downloads
Cumulative downloads
Total Downloads
1,842
Last day
200%
6
Compared to previous day
Last week
-8.5%
75
Compared to previous week
Last month
29.2%
345
Compared to previous month
Last year
0%
1,842
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
27
React Effect Typewriter
react-effect-typewriter
is a lightweight and highly customizable React library that allows you to create captivating typewriter effects. The library's primary focus is on simplicity, customizability, SEO-friendliness and accessibility, ensuring that you can deliver engaging text animations while maintaining best coding practices.
The package comprises two main components - Paragraph and Container. The Paragraph component animates your text to appear one character at a time, and the Container component, a wrapper component, can hold multiple Paragraph components or other nested Container components to create more complex animations.
Installation
1npm install react-effect-typewriter
Usage
All you need to start using the library is importing it & using the Paragraph
element & it'll immediately give you the effect, see the code below:
1import * as Typewriter from "react-effect-typewriter"; 2 3const App = () => { 4 return <Typewriter.Paragraph>Hello Typewriter!</Typewriter.Paragraph>; 5};
Under the hood, the Typewriter.Paragraph
is a normal <p>
element, so you can pass to it any props you can normal pass to a <p>
element like className
, id
, onClick
, ...etc.
In addition to that, there are a couple of custom props that you can use to customize the effect. These options are:
Parameter | Description | Default Value |
---|---|---|
typingSpeed ? | (Optional) The speed with which the characters are typed. Defined in milliseconds. | 50 |
startAnimation ? | (Optional) If true, will start animation on mount, otherwise will wait for the prop value to become true. | true |
onStart ? | (Optional) A callback that is triggered when the typing animation starts. | - |
onEnd ? | (Optional) A callback that is triggered when the typing animation ends. | - |
onCancel ? | (Optional) A callback that is triggered if the typing animation is cancelled. | - |
onCharacter ? | (Optional) A callback that is triggered each time a character is typed. The typed character is passed as an argument to this function. | - |
Nesting Paragraphs
By default, the Paragraph
element will start its animation as soon as it mounts on the DOM.
However, you might have multiple paragraphs & you only want a paragraph to start appearing once the previous paragraphs have fully appeared, or you want them to only appear once a certain condition is met, for that, there is another element which is the Typewriter.Container
element.
The Container
element will make all its Paragraph
children (doesn't have to be direct) only animate one after the other, based on the order of their appearance in the tree.
It can also have another Container
component as a children, so it will wait for the child Container
to finish all its nested children before moving to other elements.
Example Usage:
1import * as Typewriter from "react-effect-typewriter"; 2 3function App() { 4 return ( 5 <Typewriter.Container> 6 <Typewriter.Paragraph>This will appear #1</Typewriter.Paragraph> 7 <Typewriter.Container> 8 <Typewriter.Paragraph>This will appear #2</Typewriter.Paragraph> 9 <Typewriter.Paragraph typingSpeed={20}> 10 This will appear #3 11 </Typewriter.Paragraph> 12 </Typewriter.Container> 13 <Typewriter.Paragraph typingSpeed={20}> 14 This will appear #4 15 </Typewriter.Paragraph> 16 </Typewriter.Container> 17 ); 18}
The Container component can take the following props:
Parameter | Description | Default Value |
---|---|---|
typingSpeed ? | (Optional) The speed with which the characters are typed. Defined in milliseconds. | - |
startAnimation ? | (Optional) If true, will start animation on mount, otherwise will wait for the prop value to become true. | true |
delayBetweenElements ? | (Optional) The delay between the start of the animation of each child element. Defined in milliseconds. | 0 |
How the effect is created
I've written a vanilla CSS/Javascript article a while ago explaining the core idea behind creating this effect in an accessible way, you can check this article here: How to create a typewriter effect that is accessible & SEO friendly
Feedback
If you have any feedback or suggestions for improvement, please feel free to open an issue or submit a pull request on GitHub. We appreciate your contributions!
No vulnerabilities found.
No security vulnerabilities found.
Other packages similar to react-effect-typewriter
typewriter-effect
[![CircleCI](https://circleci.com/gh/tameemsafi/typewriterjs.svg?style=svg)](https://circleci.com/gh/tameemsafi/typewriterjs)
react-simple-typewriter
A simple react component for adding a nice typewriter effect to your project.
react-typewriter-effect
creating a typewriter effect using react
react-type-animation
Customizable React typing animation component based on typical.