vue-otp-input

How to Install
4,412 6
Install
npm install vue-otp-input
Latest Version:1.0.0
Vue:2
License:MIT
Last Updated:Feb 11, 2019
Links: GitHub  ·  npm
Maintainer: deepaksisodiya

vue-otp-input

How to Install

npm install vue-otp-input --save

codesandbox example

https://codesandbox.io/s/x72or1nyvw

How to use it

<template>
  <div>
    <OTPInput
      :isDisabled="isDisabled"
      :isError="isError"
      :onChangeOTP="onChangeOTP"
      :shouldResetOTP="shouldResetOTP"
      :numberOfInput="6"
    />
  </div>
</template>

<script>
import OTPInput from "vue-otp-input";

export default {
  name: "app",

  components: {
    OTPInput
  },

  data() {
    return {
      otp: null,
      isDisabled: false,
      isError: false,
      shouldResetOTP: false
    };
  },

  methods: {
    onChangeOTP(otp) {
      this.otp = otp;
    }
  }
};
</script>

Props

If you want to reset the OTP input then set the value of shouldResetOTP props as follows

this.shouldResetOTP = !this.shouldResetOTP;
Prop name type default value Required Props
isDisabled Boolean false false
IsError Boolean false false
onChangeOTP Function true
shouldResetOTP Boolean false false
numberOfInput Number 4 false
otpInputStyle Object false
error Object false

Version History

Version Released Vue License
1.0.0 ^2.5.22 MIT
0.1.9 ^2.5.22 MIT
0.1.8 ^2.5.22 MIT
0.1.7 ^2.5.22 MIT
0.1.6 ^2.5.22