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

@bachdgvn/vue-otp-input

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bachdgvn/vue-otp-input

A fully customizable, one-time password input component for the web built with Vue 2.x.

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.6K
decreased by-34.42%
Maintainers
1
Weekly downloads
 
Created
Source

vue-otp-input

A fully customizable, OTP(one-time password) input component built with Vue 2.x.

Imgur

Live Demo

Installation

To install the latest stable version:

npm install --save @bachdgvn/vue-otp-input

Basic usage:

import VieOtpInput from "@bachdgvn/vue-otp-input";

Vue.component("vie-otp-input", VieOtpInput);
<template>
  <div>
    <vie-otp-input
      inputClasses="otp-input"
      :numInputs="4"
       separator="-"
      :shouldAutoFocus="true"
      @on-complete="handleOnComplete"
    />
  </div>
</template>

<script>
export default {
  methods: {
    handleOnComplete(value) {
      console.log("OTP: ", value);
    }
  }
};
</script>

<style lang="less">
.otp-input {
  width: 40px;
  height: 40px;
  padding: 5px;
  margin: 0 10px;
  font-size: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  textalign: "center";

  &.error {
    border: 1px solid red !important;
  }
}
</style>

Props

Name
TypeRequiredDefaultDescription
num-inputsnumbertrue4Number of OTP inputs to be rendered.
separatorcomponent
falseProvide a custom separator between inputs by passing a component. For instance, <span>-</span> would add - between each input
input-classesclassName (string)falsenoneStyle applied or class passed to each input.
should-auto-focusbooleanfalsefalseAuto focuses input on inital page load.
is-input-numbooleanfalsefalseRestrict input to only numbers.

Events

Name
Description
on-completeReturn OTP code typed in inputs.

Keywords

FAQs

Package last updated on 05 Mar 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