Gathering detailed insights and metrics for @michaelwwn/react-simple-typewriter
Gathering detailed insights and metrics for @michaelwwn/react-simple-typewriter
Gathering detailed insights and metrics for @michaelwwn/react-simple-typewriter
Gathering detailed insights and metrics for @michaelwwn/react-simple-typewriter
npm install @michaelwwn/react-simple-typewriter
Typescript
Module System
Min. Node Version
Node Version
NPM Version
52.2
Supply Chain
92.8
Quality
75.2
Maintenance
100
Vulnerability
100
License
TypeScript (79.16%)
JavaScript (17.17%)
CSS (3.67%)
Total Downloads
238
Last Day
1
Last Week
2
Last Month
6
Last Year
48
133 Stars
129 Commits
26 Forks
2 Watching
1 Branches
5 Contributors
Latest Version
5.0.1
Package Id
@michaelwwn/react-simple-typewriter@5.0.1
Unpacked Size
29.41 kB
Size
9.17 kB
File Count
10
NPM Version
8.3.1
Node Version
17.4.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
100%
2
Compared to previous week
Last month
200%
6
Compared to previous month
Last year
-46.7%
48
Compared to previous year
28
A simple react component for adding a nice typewriter effect to your project.
1npm i react-simple-typewriter
1yarn add react-simple-typewriter
There are two ways to Typewriter
:
1import React from 'react' 2import { Typewriter } from 'react-simple-typewriter' 3 4const MyComponent = () => { 5 return ( 6 <div className='App'> 7 <Typewriter {/* Props */} /> 8 </div> 9 ) 10}
Prop | Type | Options | Description | Default |
---|---|---|---|---|
words | array | Required | Array of strings holding the words | ['Hello', '...'] |
typeSpeed | number | Optional | Character typing speed in Milliseconds | 80 |
deleteSpeed | number | Optional | Character deleting speed in Milliseconds | 50 |
delaySpeed | number | Optional | Delay time between the words in Milliseconds | 1500 |
loop | number | boolean | Optional | Control how many times to run. 0 | false to run infinitely | 1 |
cursor | boolean | Optional | Show / Hide a cursor | false |
cursorStyle | ReactNode | Optional | Change the cursor style available if cursor is enabled | | |
cursorBlinking | boolean | Optional | Enable cursor blinking animation | | |
onLoopDone | function | Optional | Callback function that is triggered when loops are completed. available if loop is > 0 | - |
onType | function | Optional | Callback function that is triggered while typing with typed words count passed | - |
onDelay | function | Optional | Callback function that is triggered on typing delay | - |
onDelete | function | Optional | Callback function that is triggered while deleting | - |
1import React from 'react' 2import { Typewriter } from 'react-simple-typewriter' 3 4const MyComponent = () => { 5 6 const handleType = (count: number) => { 7 // access word count number 8 console.log(count)} 9 } 10 11 const handleDone = () => { 12 console.log(`Done after 5 loops!`) 13 } 14 15 return ( 16 <div className='App'> 17 <h1 style={{ paddingTop: '5rem', margin: 'auto 0', fontWeight: 'normal' }}> 18 Life is simple{' '} 19 <span style={{ color: 'red', fontWeight: 'bold' }}> 20 {/* Style will be inherited from the parent element */} 21 <Typewriter 22 words={['Eat', 'Sleep', 'Code', 'Repeat!']} 23 loop={5} 24 cursor 25 cursorStyle='_' 26 typeSpeed={70} 27 deleteSpeed={50} 28 delaySpeed={1000} 29 onLoopDone={handleDone} 30 onType={handleType} 31 /> 32 </span> 33 </h1> 34 </div> 35 ) 36}
BREAKING CHANGES v5.0.0 Hook now returns text
along with some useful flags
:
Prop | Type | Description |
---|---|---|
isType | boolean | Check if currently typing |
isDelete | boolean | Check if currently deleting |
isDelay | boolean | Check if currently on delay |
isDone | boolean | Check if all running loops are done |
1import { useTypewriter } from 'react-simple-typewriter' 2 3const MyComponent = () => { 4 /** 5 * @returns 6 * text: [string] typed text 7 * NEW helper: {} helper flags 8 */ 9 const [text, helper] = useTypewriter({ 10 /* Config */ 11 }) 12 13 /* Hook helper */ 14 const { isType, isDelete, isDelay, isDone } = helper 15 16 return ( 17 <div className='App'> 18 <span>{text}</span> 19 </div> 20 ) 21}
Prop | Type | Options | Description | Default |
---|---|---|---|---|
words | array | Required | Array of strings holding the words | ['Hello', '...'] |
typeSpeed | number | Optional | Character typing speed in Milliseconds | 80 |
deleteSpeed | number | Optional | Character deleting speed in Milliseconds | 50 |
delaySpeed | number | Optional | Delay time between the words in Milliseconds | 1500 |
loop | number | boolean | Optional | Control how many times to run. 0 | false to run infinitely | 1 |
onLoopDone | function | Optional | Callback function that is triggered when loops are completed. available if loop is > 0 | - |
onType | function | Optional | Callback function that is triggered while typing | - |
onDelete | function | Optional | Callback function that is triggered while deleting | - |
onDelay | function | Optional | Callback function that is triggered on typing delay | - |
1import React from 'react' 2import { useTypewriter } from 'react-simple-typewriter' 3 4const MyComponent = () => { 5 const [text] = useTypewriter({ 6 words: ['Hello', 'From', 'Typewriter', 'Hook!'], 7 loop: 0 8 }) 9 10 return ( 11 <div className='App'> 12 <span>{text}</span> 13 </div> 14 ) 15}
If you like to have the Cursor effect, you can import
it as a separate Component
1import React from 'react' 2import { useTypewriter, Cursor } from 'react-simple-typewriter' 3 4const MyComponent = () => { 5 const [text] = useTypewriter({ 6 words: ['Hello', 'From', 'Typewriter', 'Hook!'], 7 loop: 3, 8 onLoopDone: () => console.log(`loop completed after 3 runs.`) 9 }) 10 11 return ( 12 <div className='App'> 13 <span>{text}</span> 14 <Cursor cursorColor='red' /> 15 </div> 16 ) 17}
Prop | Type | Options | Description | Default |
---|---|---|---|---|
cursorStyle | ReactNode | Optional | Change cursor style | | |
cursorColor | String | Optional | Change cursor color | inherit |
cursorBlinking | Boolean | Optional | disable cursor blinking animation | true |
MIT © awran5
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
40 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More