1.0.10 • Published 3 years ago

otp-manager-react v1.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

otp-manager-react

A highly customizable and easy to use OTP Generator and verifier in React JS. Just import the library and send your inputs. It will generate the OTP, send to backend, and verify it once submitted. The OTP Expires in 5 mins. Will customise this in future if required.

NPM JavaScript Style Guide

Github Repo

https://github.com/arunkarri/otp-manager-react

Install

npm install --save otp-manager-react

Demo

https://otp-manager-arun.netlify.app/

Usage

import React from 'react'

import { ReactOTPGenerator } from 'otp-manager-react'
import 'otp-manager-react/dist/index.css'

const App = () => {
  function callback(res) {
    console.log('callback function')
    console.log(res)
  }
  return (
    //Below example has bootstrap classes.
    <ReactOTPGenerator
      label='My OTP Manager Company'
      mainContainerClass='container'
      emailContainerClass='form-group'
      emailLabel='Email'
      emailFieldClass='form-control mb-3 mt-3'
      otpContainerClass='form-group'
      otpLabel='OTP'
      otpFieldClass='form-control'
      getBtnRowClass='text-center mb-1 mt-3'
      getBtnClasses='btn btn-info'
      getBtnLabel='Get OTP'
      verifyBtnRowClass='text-center'
      verifyBtnClasses='btn btn-success'
      verifyBtnLabel='Verify OTP'
      action={callback}
    />
  )
}

export default App

Props

Prop namePurpose
labelProduct/Company name to be displayed in the From Field of the Email
mainContainerClassClasses for the main Container of the fields
emailContainerClassClasses for the email field container
emailLabelLabel to be displayed for the email field
emailFieldClassClasses to be passed for the input Email field
otpContainerClassClasses for the otp field container
otpLabelLabel to be displayed for the otp field
otpFieldClassClasses to be passed for the input otp field
getBtnRowClassClasses for the Get OTP Button Div
getBtnClassesClasses for the Get OTP Button
getBtnLabelDisplay label for the Get OTP Button
verifyBtnRowClassClasses for the Verify OTP Button Div
verifyBtnClassesClasses for the Verify OTP Button
verifyBtnLabelDisplay label for the Verify OTP Button
actioncallback function to be called after otp is verified

Donate

License

MIT ©