Gathering detailed insights and metrics for otp-input-react
Gathering detailed insights and metrics for otp-input-react
Gathering detailed insights and metrics for otp-input-react
Gathering detailed insights and metrics for otp-input-react
npm install otp-input-react
Typescript
Module System
Node Version
NPM Version
77.1
Supply Chain
96.6
Quality
76.1
Maintenance
100
Vulnerability
100
License
JavaScript (98.49%)
HTML (1.51%)
Total Downloads
1,067,741
Last Day
1,220
Last Week
5,257
Last Month
25,603
Last Year
357,960
59 Stars
127 Commits
87 Forks
4 Watching
15 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
0.3.0
Package Id
otp-input-react@0.3.0
Unpacked Size
48.57 kB
Size
15.44 kB
File Count
5
NPM Version
7.15.1
Node Version
16.3.0
Cumulative downloads
Total Downloads
Last day
0.9%
1,220
Compared to previous day
Last week
-19.9%
5,257
Compared to previous week
Last month
-8.9%
25,603
Compared to previous month
Last year
5%
357,960
Compared to previous year
58
A fully customizable, one-time password input with resend OTP component for the web built with React functional component.
npm install --save otp-input-react
1import OTPInput, { ResendOTP } from "otp-input-react"; 2 3function App() { 4 const [OTP, setOTP] = useState(""); 5 return ( 6 <> 7 <OTPInput value={OTP} onChange={setOTP} autoFocus OTPLength={4} otpType="number" disabled={false} secure /> 8 <ResendOTP onResendClick={() => console.log("Resend clicked")} /> 9 </> 10 ); 11}
Name | Type | Required | Default | Description | Status |
---|---|---|---|---|---|
OTPLength | Number | false | 4 | Number of input boxes. | Working |
onChange | Function | true | - | Returns OTP code typed in inputs. | Working |
value | String / Number | true | '' | The value of the otp passed into the component. | Working |
disabled | Boolean | false | false | Disables all the inputs. | Working |
autoFocus | Boolean | false | false | Auto focuses input on initial page load. | Working |
otpType | Enum: any |number |alpha |alphanumeric | false | any | any - allows any value. number - allow only numbers. alpha - allows only a-zA-Z . alphanumeric - allows 0-9a-zA-z | Working |
secure | Boolean | false | false | Change input type to password. | Working |
inputClassName | String | - | - | Class for root element. | Working |
className | String | - | - | Class for root element. | Working |
inputStyles | Object | - | - | Styles for input element. | Working |
style | Object | - | - | Styles for root element. | Working |
placeholder | Array<String> | false | - | Placeholder value of each input. | Working |
Name | Type | Required | Default | Description | Status |
---|---|---|---|---|---|
maxTime | Number | false | 60 | Timer that user has to wait before resend otp gets active. | Working |
onResendClick | Function | true | - | Function get triggers when user click on resend otp button. But when button is disabled(i.e. time is not completed) it won't get trigger | Working |
onTimerComplete | Function | false | - | An optional callback when timer completes. | Working |
timeInterval | Number | false | 1000 | You can change time interval. | Working |
renderTime | Function - render props | false | - | You can use your own component for seconds. Function will get remainingTime as props you can use it to show timer. | Working |
renderButton | Function - render props | false | - | You can use your own component for resend button. Function will get disabled and onClick function and remainingTime as props you can pass it to your component. | Working |
style | Object | false | - | For changing root component inline styles | Working |
className | string | false | - | For adding class to root component. | Working |
1const renderButton = (buttonProps) => { 2 return <button {...buttonProps}>Resend</button>; 3}; 4const renderTime = (remainingTime) => { 5 return <span>{remainingTime} seconds remaining</span>; 6}; 7<ResendOTP renderButton={renderButton} renderTime={renderTime} />;
1const renderButton = (buttonProps) => { 2 return ( 3 <button {...buttonProps}> 4 {buttonProps.remainingTime !== 0 ? `Please wait for ${buttonProps.remainingTime} sec` : "Resend"} 5 </button> 6 ); 7}; 8const renderTime = () => React.Fragment; 9<ResendOTP renderButton={renderButton} renderTime={renderTime} />;
https://github.com/hotdang-ca - For adding alpha|alphanumeric
type and updating docs
Feel Free to contributing or feature request
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/9 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
89 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
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 Moreinput-otp
One-time password input component for React.
react-otp-input
A fully customizable, one-time password input component for the web built with React
react18-input-otp
A fully customizable, one-time password (OTP) and phone number with separator input component for the web built with React.
mui-one-time-password-input
A One-Time Password input designed for the React library MUI