Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

otp-input-react

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

otp-input-react

React functional component for otp input

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.2K
decreased by-8.14%
Maintainers
1
Weekly downloads
 
Created
Source

otp-input-react

A fully customizable, one-time password input component for the web built with React functional component.

NPM npm

GIPHY

Working Demo

Installation

npm install --save otp-input-react

Usage:

function App() {
  const [OTP, setOTP] = useState("");
  return (
    <OTPInput
      value={OTP}
      onChange={setOTP}
      autoFocus
      OTPLength={4}
      otpType="number"
      disabled={false}
      secure
    />
  );
}

API

NameTypeRequiredDefaultDescriptionStatus
OTPLengthnumberfalse4Number of input boxes.Working
onChangefunctiontrue-Returns OTP code typed in inputs.Working
valuestring / numbertrue''The value of the otp passed into the component.Working
disabledbooleanfalsefalseDisables all the inputs.Working
autoFocusbooleanfalsefalseAuto focuses input on inital page load.Working
otpTypeEnum: any|number|alpha|alphanumericfalseanyany - allows any value. number - allow only numbers. alpha - allows only a-zA-Z. alphanumeric - allows 0-9a-zA-zWorking
secureBooleanfalsefalseChange input type to password.Working
inputClassNameString--Class for root element.Working
classNameString--Class for root element.Working
inputStylesObject--Styles for input element.Working
styleObject--Styles for root element.Working

TODO

  • Add other type input
  • [] Change scaffolding
  • [] Add CI
  • [] Add OTP Timer with resend otp optional type

Credits

https://github.com/hotdang-ca - For adding alpha|alphanumeric type and updating docs

Contributing

Feel Free to contributing or feature request

  1. Fork it ( https://github.com/shubhanus/otp-input-react/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new pull request.

Keywords

FAQs

Package last updated on 24 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc