Gathering detailed insights and metrics for react18-otp-input
Gathering detailed insights and metrics for react18-otp-input
npm install react18-otp-input
Typescript
Module System
Node Version
NPM Version
JavaScript (79.45%)
CSS (17.63%)
HTML (2.92%)
Total Downloads
74,194
Last Day
40
Last Week
349
Last Month
4,041
Last Year
36,166
1 Stars
11 Commits
1 Forks
1 Watching
2 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
react18-otp-input@1.0.3
Unpacked Size
24.90 kB
Size
7.71 kB
File Count
5
NPM Version
8.11.0
Node Version
16.15.1
Cumulative downloads
Total Downloads
Last day
-86.9%
40
Compared to previous day
Last week
-83.3%
349
Compared to previous week
Last month
-2.7%
4,041
Compared to previous month
Last year
35.9%
36,166
Compared to previous year
24
A fully customizable, one-time password input component for the web built with React. This package is based on great work of contributers of react-otp-input
. But i needed this package and for unknown reasons the contributers of the original package does not accept the open PRs that solve the REACT 18 dependency problem. So based on The PR here i created this package for the others who need this.
To see the original package Click
npm install --save react18-otp-input
1import React, { useState } from 'react'; 2 3import OtpInput from 'react18-otp-input'; 4 5function App() { 6 const [otp, setOtp] = useState(''); 7 8 return ( 9 <OtpInput 10 inputStyle="inputStyle" 11 numInputs={4} 12 onChange={(value) => setOtp(value)} 13 separator={<span>-</span>} 14 isInputNum={true} 15 shouldAutoFocus 16 value={otp} 17 /> 18 ); 19} 20 21export default App;
Name | Type | Required | Default | Description |
---|---|---|---|---|
numInputs | number | true | 4 | Number of OTP inputs to be rendered. |
onChange | function | true | console.log | Returns OTP code typed in inputs. |
value | string / number | true | '' | The value of the OTP passed into the component. |
placeholder | string | false | none | Specify an expected value of each input. The length of this string should be equal to numInputs . |
separator | component | false | none | Provide a custom separator between inputs by passing a component. For instance, <span>-</span> would add - between each input. |
containerStyle | style (object) / className (string) | false | none | Style applied or class passed to container of inputs. |
inputStyle | style (object) / className (string) | false | none | Style applied or class passed to each input. |
focusStyle | style (object) / className (string) | false | none | Style applied or class passed to inputs on focus. |
isDisabled | boolean | false | false | Disables all the inputs. |
disabledStyle | style (object) / className (string) | false | none | Style applied or class passed to each input when disabled. |
hasErrored | boolean | false | false | Indicates there is an error in the inputs. |
errorStyle | style (object) / className (string) | false | none | Style applied or class passed to each input when errored. |
shouldAutoFocus | boolean | false | false | Auto focuses input on initial page load. |
isInputNum | boolean | false | false | Restrict input to only numbers. |
isInputSecure | boolean | false | false | Masks input characters. |
data-cy | string | false | - | Test attribute passed to the inputs. |
data-testid | string | false | - | Test attribute passed to the inputs. |
npm run dev
Thanks goes to these wonderful people (emoji key):
Mahdi Mohaqeq 💻🚧 🤔 👀 |
This project follows the all-contributors specification. Contributions of any kind welcome!
No vulnerabilities found.
No security vulnerabilities found.