# v3-pin-input

> ``` npm install v3-pin-input --save ```

Latest version **0.0.2** (published 2023-07-26) · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2023-07-26 |
| First published | 2023-07-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lilsvensken |
| Maintainers | lilsvensken |
| Keywords | vue, pin, pin-code, input, vue-component, form-component |

## Links

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

## Dependencies (3)

- [vue](https://npm.io/package/vue.md) ^3.3.2
- [sass](https://npm.io/package/sass.md) ^1.62.1
- [@vue/eslint-config-prettier](https://npm.io/package/@vue/eslint-config-prettier.md) ^7.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2023-07-26
- 0.0.1 — 2023-07-25
- 0.0.0 — 2023-07-25

## README

# pin-input
#### PIN-Input is a Vue component o capture PIN/MPIN like input

## Demo
### Live example [here](https://codesandbox.io/p/github/lilSvensken/pin-input/)

## Installation
```
npm install v3-pin-input --save
```

## Usage
```js
// index.js
import { createApp } from "vue";
import App from "./App.vue";
import PinInput from "/node_modules/v3-pin-input/dist/pin-input.es";
import "/node_modules/v3-pin-input/dist/style.css";

const app = createApp(App);
app.use(PinInput);
app.mount("#app");
```
```html
<!-- vue component -->
<template>
  <form @submit="onSubmit">
    <pin-input
      :count="6"
      :defaultValue="inputValue"
      :hidden="false"
      @on-change="onChange"
      @on-error="onError"
    />
  </form>
</template>

<script>
  export default {
    name: "component",
    data() {
      return {
        inputValue: 6,
      };
    },
    methods: {
      onChange(newInputValue) {
        this.inputValue = Number(newInputValue);
      },
      onClear() {
        this.inputValue = "";
      },
      onError(message) {
        alert(message);
      },
      onSubmit(e) {
        e.preventDefault();
        alert(`newInputValue: ${this.inputValue}`);
      },
    },
  };
</script>
```

## Props:

| Property                | Type    | Description                                                         |
|:------------------------|:--------|:--------------------------------------------------------------------|
| count                   | number  | the number of symbols in the pin code                               |
| defaultValue            | string  | Optional parameter. The default value to be entered in the inputs   |
| hidden                  | boolean | Do I need to hide characters during user input (`type="password"`)  |

## Methods:

| Property   | Event   | Description                                                               |
|:-----------|:--------|:--------------------------------------------------------------------------|
| @on-change | string  | triggered when the user changes the field. Returns the new pin-code value |
| @on-error  | string  | Triggered when data is entered incorrectly. Returns an error message      |

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