0.1.10 • Published 2 years ago

react-otp-inpt v0.1.10

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

react-otp-inpt

A simple OTP input.

ezgif com-gif-maker

Example

import CustomOTPInput from 'react-otp-inpt/dist/components/CustomOTPInput';

const App = () => {

    const [otp, setOtp] = useState("") 

  return (
        <CustomOTPInput 
            placeholder="Enter OTP"
            value={otp}
            onChange={value => setOtp(value)}    
        />
  );
}

Props

PropTypeDefaultDescription
onChangefunctionRequiredReturns OTP code typed in inputs
valueStringRequiredThis is will be the value displayed on the input
placeholderString-Give placeholder to give show a placeholder text initially (this will go on focus of the input), if placeholder is given no value, then it will directly show the otp inputs

Styling Props

PropTypeDefaultDescription
classNameStringThis is the is to change the styles of the outer most div
outerInputClassNameStringThis is to change styles of the outer input
otpWrapperClassNameStringThis is to change the styles of the wrapper div of the inner otp inputs
otpInputsClassNameStringThis is to change the styles of the inner otp inputs