react-otpcode-input
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

react-otpcode-input

An OTP input component using React

Install

npm install react-otpcode-input --save

Usage

ES6

import OtpInput from 'react-otpcode-input';

Typescript

import OtpInput from 'react-otpcode-input';

Props

Props Options Default Description
numberOfInputs Number none Number of OTP inputs to be rendered.
onChange (code) => void none Returns OTP code typed in inputs.
onComplete (code) => void none Callback when OTP is completely filled.
otp String none The value of the OTP passed into the component.
disabled boolean none Disables all the inputs.
autoFocus boolean none Auto focuses input on initial page load.

Examples

import OtpInput from 'react-otpcode-input';

<OtpInput
  numberOfInputs={6}
  onChange={(code) => console.log(code)}
  onComplete={(code) => console.log(code)}
  otp={""}
  autoFocus={true}
/>

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i react-otpcode-input

Weekly Downloads

50

Version

1.1.7

License

MIT

Unpacked Size

17.5 kB

Total Files

9

Last publish

Collaborators

  • him-2c
  • omegaspn
  • pakornsak
  • bunyawat