0.0.2 • Published 2 years ago

react-otpjs v0.0.2

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

react-otpjs

License: MIT Generic badge

A react-otpjs is a simple fully customizable react OTP field component.

Demo

Codesandbox DemoInteractive Demo

Installation

To install the latest stable version:

Using yarn

yarn add react-otpjs

Using npm

npm i react-otpjs

Basic Usage

import React, { useState } from 'react';
import  { OTPInput } from "react-otpjs";
const App = () => {
const [value, setValue] = useState('');
return (
      <OTPInput
      value={value}
      onChange={(otp)=>setValue(otp)}
      numInputs={4}
      />
   );
 };
       

API

NameTypeRequiredDefault
numOfInputsnumbertrue
fieldWidthstringfalse50px
fieldHeightsringfalse50px
placeHolderstringfalse*
fieldSeperatorReactNodefalse-
filedClassNamestringfalse
containerClassNamestringfalse
autoFocusbooleanfalsefalse
disabledbooleanfalsefalse
isErrorbooleanfalsefalse
isTypeNumberbooleanfalsetrue
errorStyleObjectfalseVisit Documentation`
inpuStyleObjectfalseVisit Documentation`
inputFocusStyleObjectfalseVisit Documentation`
onChangeFunctiontrueVisit Documentation`