Vue Mask Next
Vue 3 Input Mask Component
Description
Vue 3 Input Mask Component
vue-mask-next is a lightweight library that provides input masking capabilities for Vue.js 3 applications. It builds on the concepts of vue-3-mask, adding features such as support for prefilled values and compatibility with the Composition API and <script setup>.
The MaskInput component is structured as follows:
Template
- Contains a single
<input>element bound to the component’svaluedata property viav-model.
Attribute Forwarding
- Uses
$attrsandv-bind="$attrs"to forward any attributes supplied to the component directly to the underlying<input>, enabling users to apply additional HTML attributes.
Script Setup
- Declares props, including a required
maskprop that defines the masking pattern. - Provides mask definitions so different characters can be interpreted uniquely within the mask pattern.
Masking Logic
- The
applyMaskfunction applies the specified masking logic and returns the masked value. - The
handleInputfunction is called on input events; it masks the current input value and updates the component’svaluedata property accordingly.
Creator
Mustafa Çağrı Güven
@mustafacagri
Related Projects
Markstream
AI-powered Streaming Markdown Renderer
Vue 3 JSON Editor
JSON Editor Component
Vuelor
Colorpicker Component
Roughness
Hand-drawn Component Library
Stk Table Vue
Virtual List Component
Phosphor Icons Vue
Icon Set