# vue-split-input

> Vue Split input for otp verification etc

Latest version **1.4.1** (published 2023-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-split-input
pnpm add vue-split-input
yarn add vue-split-input
bun add vue-split-input
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.4.1 |
| Published | 2023-02-12 |
| First published | 2021-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 34.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | damilare anjorin |
| Maintainers | damilaredev |
| Keywords | vue, vue 2, vue 3, vuejs, component, input, split-input, multiple-input, otp input, transaction pin, one time password |

## Links

- npm: https://www.npmjs.com/package/vue-split-input
- Repository: https://github.com/dammy001/vue-split-input
- Homepage: https://github.com/dammy001/vue-split-input#readme
- Issues: https://github.com/dammy001/vue-split-input/issues
- npm.io page: https://npm.io/package/vue-split-input

## Recent versions

- 1.4.1 (latest) — 2023-02-12
- 1.3.1 — 2022-10-07
- 1.2.0 — 2022-05-21
- 1.1.2 — 2022-05-01
- 1.1.0 — 2022-02-19
- 1.0.9 — 2022-02-05
- 1.0.8 — 2022-02-05
- 1.0.7 — 2022-02-05
- 1.0.6 — 2022-02-05
- 1.0.5 — 2022-02-05
- 1.0.4 — 2022-02-05
- 1.0.3 — 2022-02-05
- 1.0.2 — 2022-02-05
- 1.0.1 — 2022-02-05
- 0.9.35 — 2022-01-21
- … 9 more at https://npm.io/package/vue-split-input/versions

## README

# Split Input Component for Vue 3.x

Used for otps, transaction pin, passwords etc

### Install

#### NPM

```bash
//with npm
npm i vue-split-input --save

//with yarn
yarn add vue-split-input

//with pnpm
pnpm i vue-split-input
```

### Usage

```
import { createApp } from 'vue';
import Root from './App.vue'
import SplitInput from 'vue-split-input';

const app = createApp(App)

app.use(SplitInput)

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

###### Props

|    Props     |                     #Type                     | #default |                  #description                  |
| :----------: | :-------------------------------------------: | :------: | :--------------------------------------------: |
| inputNumber  |                    Number                     |    6     |           Number for input rendered            |
|     type     | String as PropType<'tel', 'password', 'text'> |  'tel'   | Input type. Optional value: `password`, `text` |
|  className   |                    String                     |    ''    |       Custom class/style for each input        |
|   disabled   |                    Boolean                    |  false   |               Disabled all input               |
| placeholder  |                    String                     |    ''    |       Default description for each input       |
| placeholders |                     Array                     |   null   |       Default description for all inputs       |

###### Events

| Name  |                          #Description                          |
| :---: | :------------------------------------------------------------: |
| focus | custom focus method that passes the input event as an argument |

###### SplitInput.vue Usage

```vue
<template>
 <split-input
  v-model="input"
  class-name="w-12 h-8 rounded-sm p-5 font-bold text-lg"
  :input-number="4"
 />
</template>
```

###### Or

```vue
<script lang="ts">
 export default defineComponent({
  template: `
            <split-input
            v-model="input"
            class-name="w-12 h-8 rounded-sm p-5 font-bold text-lg"
            :input-number="4"
            />
        `,
 });
</script>
```

You can also pass a ref to access the component dom and objects directly

```vue
<script setup lang="ts">
 import { ref } from 'vue';
 import type { ComponentPublicInstance } from 'vue';
 import type { Prop } from 'vue-split-input';

 const input = ref<ComponentPublicInstance<Prop> | null>(null);
 const clear = () => input.value?.clearAllInput();
</script>

<template>
 <split-input
  ref="input"
  v-model="input"
  class-name="w-12 h-8 rounded-sm p-5 font-bold text-lg"
  :input-number="4"
 />
 <button
  type="button"
  @click="clear"
  class="px-6 bg-blue-500 text-white text-xs ml-2"
 >
  CLEAR ALL
 </button>
</template>
```

Thanks!
Damilare.

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