# vue3-otp-input **Repository Path**: mirrors_ejirocodes/vue3-otp-input ## Basic Information - **Project Name**: vue3-otp-input - **Description**: 🐗 A fully customisable OTP input component for Vue 3.x - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-02-28 - **Last Updated**: 2025-11-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vue3-otp-input > Vue 3 OTP Input is a 5.0 KB fully customizable OTP (one-time password) input component for OTPs, transaction pins, and passwords built with Vue 3.x and Vue Composition API.. ## Documentation Link to doc ## ðŸ“đ Demo ![Gifphy](https://media.giphy.com/media/Db04PkC7vMzqksOpq6/giphy.gif) ## ⚙ïļ Installation ### Install as package You can install `vue3-otp-input` via the terminal. ```sh pnpm i vue3-otp-input ``` OR ### Install via CDN ```sh ``` ## 📖 Usage [Demo](https://github.com/ejirocodes/vue3-otp-input/blob/main/src/App.vue) ### 1/3. Register as a Vue component locally OR ```ts ``` ### 1/3. Register as a Vue component globally ```js // main.js or main.ts import { createApp } from 'vue' import App from './App.vue' import VOtpInput from "vue3-otp-input"; const app = createApp(App) app.component('v-otp-input', VOtpInput).mount('#app') ``` ### 2/3. Use the registered component in your Vue template ```html ``` ### 3/3 [Optional]. Some basic styling options #### This css has to go into a ` ``` ## 🍔 Props
Name
Type Required Default Description
value string false "" v-modal:value for bind dynamic value
num-inputs number true 4 Number of OTP inputs to be rendered.
separator component
false Provide a custom separator between inputs by passing a component. For instance, <span>-</span> would add - between each input
input-classes className (string) false none Style applied or class passed to each input.
input-type string false "tel" Input type. Optional value: "password", "number", "tel", "letter-numeric".
inputmode string false "numeric" This allows a browser to display an appropriate virtual keyboard. Optional value: "numeric", "text", "tel". [Learn More](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)
should-auto-focus boolean false false Auto focuses input on inital page load.
should-focus-order boolean false false Auto correct the input order. See https://github.com/ejirocodes/vue3-otp-input/pull/39
placeholder array false [] Specify an expected value for each input. Example: :placeholder="['*', '*', '*', '*']". The length of this array should be equal to num-inputs.
conditionalClass array false [] Specify a class to be applied to each input based on the value of the input. Example: :conditionalClass="['one', 'two', 'three', 'four']". The length of this array should be equal to num-inputs.
is-disabled boolean false false Disables all the input fields.
## ðŸĪš Methods
Name
Description
clearInput() Use with ref for clearing all otp inputs, see code example section.
fillInput() Use with ref for fill otp inputs. The value should be same length as `numInputs` length. See code example section.
## ðŸī Events
Name
Description
on-change Return OTP code was changing when we made a change in inputs.
on-complete Return OTP code typed in inputs.
## ðŸĪŸðŸ― License [MIT](https://choosealicense.com/licenses/mit/) ## 📓 Contributing Contributions are always welcome! See `contributing.md` for ways to get started. Please adhere to this project's `code of conduct`. ## ðŸ§ļ Appendix This component is a rewite of [vue-otp-input](https://github.com/bachdgvn/vue-otp-input) component to support Vue 3.x. Feel free to use it in your project, report bugs and make PR ðŸ‘ðŸ―.