# v-pin-input

> Vue Pin Input is a Vue 3 input component for pins, otp etc.

Latest version **1.0.1** (published 2023-10-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install v-pin-input
pnpm add v-pin-input
yarn add v-pin-input
bun add v-pin-input
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-10-03 |
| First published | 2022-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Stelios Kamnakis |
| Maintainers | kamnis1997 |
| Keywords | vue, vue 3, vuejs, pin, input, pin-input, multiple-input, otp input, transaction pin, one time password |

## Links

- npm: https://www.npmjs.com/package/v-pin-input
- Repository: https://github.com/kamnakis/v-pin-input
- Homepage: https://github.com/kamnakis/v-pin-input#readme
- Issues: https://github.com/kamnakis/v-pin-input/issues
- npm.io page: https://npm.io/package/v-pin-input

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-10-03
- 1.0.0 — 2023-10-03
- 0.0.24 — 2022-03-14
- 0.0.22 — 2022-03-12
- 0.0.21 — 2022-03-12
- 0.0.20 — 2022-03-12
- 0.0.19 — 2022-03-12
- 0.0.17 — 2022-03-12
- 0.0.16 — 2022-03-12
- 0.0.15 — 2022-03-12
- 0.0.14 — 2022-03-11
- 0.0.12 — 2022-03-11
- 0.0.11 — 2022-03-11
- 0.0.10 — 2022-03-11
- 0.0.9 — 2022-03-11
- … 4 more at https://npm.io/package/v-pin-input/versions

## README

# Vue Pin Input (Vue 3)

Vue Pin Input is a Vue 3 input component for pins, otp etc.

Here is a live [demo](https://kamnakis.github.io/v-pin-input-demo/)

![demo image](https://i.ibb.co/JHPLYWg/image.png)


## Installation


```bash
yarn add v-pin-input
# or
npm i v-pin-input
```


## Plugin installation
```ts
import { createApp } from 'vue'
import App from './App.vue'

import PinInput from 'v-pin-input'

const app = createApp(App)

app.use(PinInput)
app.mount('#app')
```

## Usage
```vue
<script setup lang="ts">
import { ref } from 'vue'

const model = ref('')

const handleCompleted = (val: string) => {
  console.log('Completed', val)
}
</script>

<template>
  <pin-input
    class="wrapper"
    v-model="model"
    :length="6"
    autofocus
    input-class="pinInput"
    @completed="handleCompleted"
  />
</template>

<style>
.wrapper {
  display: flex;
  gap: 4px;
}

.pinInput {
  width: 20px;
  padding: 4px;
  border: none;
  border-bottom: 2px solid black;
  font-size: 1.5rem;
  color: black;
  margin-right: 4px;
  text-align: center;
}

.pinInput:focus {
  outline: none;
}
</style>
```


### Props
| Property              | Type       | Default  | Description |
| :-------------------- | :--------- | :------- | :---------- |
| `length` | `number`     | `4`   | The amount of the inputs |
| `autofocus`       | `boolean`     | `true`   | Autofocus on first input on component load. |
| `secure`       | `boolean`     | `false`   | Display * instead of character |
| `characterPreview`       | `boolean`     | `true`   | Display character before switch to * in secure mode |
| `charPreviewDuration`       | `number`     | `300`   | Ms to show the character before switch back to * |
| `blurOnComplete`       | `boolean`     | `false`   | true if you want to blur the input when completed |


### Events
| Name                  | Payload              | Description |
| :-------------------- | :--------- | :---------- |
| `completed`           | `string`             | Called once the user completes the input (fills the last empty input) |


## References
This is pretty much a combination of [vue-split-input](https://github.com/dammy001/vue-split-input) and [vue-pincode-input](https://github.com/Seokky/vue-pincode-input)

---
_Source: https://npm.io/package/v-pin-input · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
