otp-box-react
v1.0.5
Published
React OTP Box/Input
Downloads
8
Maintainers
Readme
OTP Box React
1.Installation
npm install --save otp-box-react
import { useState } from 'react';
import { OtpInput } from 'otp-box-react';
2.Usage
const [state, setState] = useState({ otp: new Array(6).fill('') });
const onChangeOtpHandler = (otpvalues, event, index) => {
setState({ ...state, otp: otpvalues });
};
<OtpInput name="otp" className="otp-field" placeholder=" " otpvalue={state.otp} onChangeOtpHandler={onChangeOtpHandler} />