# vue-text-mask

> Vue component for input masking

Latest version **6.1.2** (published 2018-07-25) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install vue-text-mask
pnpm add vue-text-mask
yarn add vue-text-mask
bun add vue-text-mask
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.1.2 |
| Published | 2018-07-25 |
| First published | 2016-05-30 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 125.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8206 |
| Author | Bill Colmbia |
| Maintainers | bcolumbia, lozjackson, msafi |
| Keywords | vue, vue-component, input mask, text mask, string mask, input formatting, text formatting, string formatting |

## Links

- npm: https://www.npmjs.com/package/vue-text-mask
- Repository: https://github.com/text-mask/text-mask
- Homepage: https://github.com/text-mask/text-mask/tree/master/vue/#readme
- Issues: https://github.com/text-mask/text-mask/issues
- npm.io page: https://npm.io/package/vue-text-mask

## 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

- 6.1.2 (latest) — 2018-07-25
- 6.1.1 — 2018-05-07
- 6.1.0 — 2018-04-29
- 6.0.2 — 2018-04-27
- 6.0.1 — 2018-04-20
- 6.0.0 — 2017-12-28
- 5.2.0 — 2017-09-09
- 5.1.1 — 2017-04-18
- 5.1.0 — 2017-03-31
- 5.0.0 — 2017-03-31
- 4.0.0 — 2017-03-22
- 3.1.3 — 2017-03-20
- 3.1.2 — 2017-03-12
- 3.1.1 — 2017-03-11
- 3.1.0 — 2017-03-09
- … 9 more at https://npm.io/package/vue-text-mask/versions

## README

# Vue Input Mask

## Getting started

First, install it.

```bash
npm i vue-text-mask --save
```

Then, use it as follows:

```html
<template>
  <div>
    <label>Phone Number</label>
    <masked-input
      type="text"
      name="phone"
      class="form-control"
      v-model="phone"
      :mask="['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]"
      :guide="false"
      placeholderChar="#">
    </masked-input>
  </div>
</template>

<script>
  import MaskedInput from 'vue-text-mask'

  export default {
    name: 'name',

    components: {
      MaskedInput
    },

    data () {
      return {
        phone: ''
      }
    }
  }
</script>
```

You could alternatively define the component globally:
```js
import Vue from 'vue'
import MaskedInput from 'vue-text-mask'

Vue.component('masked-input', MaskedInput);
```

`<masked-input>` is essentially a wrapped `<input>` element - so it supports all the regular input properties (type, placeholder, class, etc). It is compatible with v-model 2-way binding, and is reactive to changes to any of the [text mask props](https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#readme).

## Documentation

For more information about the `props` that you can pass to the component, see
the [documentation here](https://github.com/text-mask/text-mask/blob/master/componentDocumentation.md#readme).

## Example

To see an example of the code running, follow these steps:

1. Clone the repo, `git clone git@github.com:text-mask/text-mask.git`
2. `npm install`
3. `npm run vue:dev`
4. Open [http://localhost:3000](http://localhost:3000)

## Contributing

We would love some contributions! Check out
[this document](https://github.com/text-mask/text-mask/blob/master/howToContribute.md#readme) to get started.

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