0.0.9 • Published 7 months ago

react-custom-otp-input v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-custom-otp

NPM

A React component library for adding OTP (One-Time Password) functionality to your project.

Install

npm install react-custom-otp-input

Usage

import React, { useState } from 'react';
import { OtpInput } from 'react-custom-otp-input';

const Example = () => {
 const [otp, setOtp] = useState('');

  return (
    <OtpInput
      length={6}
      onChangeOtp={(otp: any) => {
        setOtp(otp);
      }}
      secure={true}
    />
  );
}

Props/Options

PropsTypeDescriptionDefault
lengthnumberThe number of OTP input fields to render. Required.6
onChangeOtpFunctionA callback function to handle the entered OTP. Required.-
securebooleanHides the entered input valuesfalse
classNamestringClass for each input fields-
widthnumberWidth for each input fields-
heightnumberHeight for each input fields-
sizenumberFont size for each input fields-
stylesstyle(object)Style for each input fields-

Full example

import React, { useState } from 'react';
import { OtpInput } from 'react-custom-otp-input';

const Example = () => {
  const [otp, setOtp] = useState('');

  return (
    <OtpInput
      length={6}
      onChangeOtp={(otp: any) => {
        setOtp(otp);
      }}
      secure={true}
    />
  );
};

\ The react-custom-otp-input library is designed to simplify the process of adding OTP functionality to your React projects. It provides an OTP component that can be easily integrated into your codebase.

To install the library, use the provided npm command, as shown in the "Install" section. Make sure to import the necessary components.

Feel free to explore the library and customize it according to your needs!

License

MIT © Oyinlola Abolrin

0.0.9

7 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago

1.0.0

4 years ago