Vue Text Mask is a Vue.js component that provides input masking capabilities, serving as a wrapper around the core `text-mask` library. It enables developers to define input formats using a declarative array of regex and static characters, supporting common use cases like phone numbers, dates, and currency. The package is currently at version 6.1.2 for Vue 2 and is part of a larger, cross-framework `text-mask` ecosystem which also includes wrappers for React, Angular, and vanilla JavaScript. While still functional, the overall `text-mask` project and its framework-specific packages appear to be in a maintenance phase, with the latest significant updates for `vue-text-mask` dating back to late 2020 or early 2021. It differentiates itself by offering robust features like pasting, browser auto-fill support, and a lightweight footprint, without external dependencies beyond its core library.
npm install vue-text-maskVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `vue-text-mask` in a basic Vue 2 application, registering the `MaskedInput` component and applying a phone number mask to an input field with `v-model`.
Review event listeners on `<masked-input>` components and adjust to standard Vue event practices. The internal event emissions might have been updated.
For Vue 3 projects, consider using dedicated Vue 3 input mask libraries like `vue-3-mask` or `v-mask` which are built with Vue 3 compatibility in mind.
Evaluate long-term project needs. For highly active development or new Vue versions, consider more actively maintained alternatives. Always test thoroughly when updating Vue itself.
Ensure `MaskedInput` is imported and added to the `components` option of your Vue component or globally registered using `Vue.component('masked-input', MaskedInput)`.Verify that the `:mask` prop is bound to a valid array (e.g., `['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, '-', /\d/, /\d/, /\d/, /\d/]`) or a function that returns a mask array.