@vueform/plugin-mask

Official input mask plugin for Vueform.
125,807 1
Install
npm install @vueform/plugin-mask
Latest Version:1.0.7
Vue:3
License:MIT
Last Updated:Jun 14, 2024
Links: GitHub  ·  npm
Maintainer: vueform
Vueform Logo

Official Input Mask plugin for Vueform

Plugin for Vueform to add input mask to text elements.

Prerequisites

Installation

  1. Install the plugin
npm install @vueform/plugin-mask
  1. Add the plugin in vueform.config.js
// vueform.config.js

import MaskPlugin from '@vueform/plugin-mask'

export default {
  // ...
  plugins: [
    MaskPlugin,
  ]
}

Usage

Pattern
<TextElement
  name="text"
  mask="{+1} (000)-000-0000"
/>
Number
<TextElement
  name="text"
  :mask="{
    mask: 'number',
    min: -10000,
    max: 10000
  }"
/>
Range
<TextElement
  name="text"
  :mask="{
    mask: 'range',
    from: 1,
    to: 90
  }"
/>
Enum
<TextElement
  name="text"
  :mask="{
    mask: 'enum',
    enum: [              
      'January',
      'February',
      'March',
      'April',
      'May',
      'June',
      'July',
      'August',
      'September',
      'October',
      'November',
      'December',
    ],
  }"
/>
Repeat
<TextElement
  name="text"
  :mask="{
    mask: 'VFr',
    blocks: {
      r: {
        repeat: Infinity, // number of times to repeat: Infinity | number | [min, max]
        mask: '-000',
      }
    },
  }"
/>
Regex
<TextElement
  name="text"
  :mask="/^[a-fA-F0-9]{0,6}$/"
/>
Date
<TextElement
  name="text"
  :mask="{
    mask: 'date',
    pattern: 'd.`m.`Y',
  }"
/>
Dynamic
<TextElement
  name="text"
  :mask="[
    {
      mask: 'rgb(RGB,RGB,RGB)',
      eager: true,
      blocks: {
        RGB: {
          mask: 'range',
          from: 0,
          to: 255
        }
      }
    },
    {
      mask: /^#[0-9a-f]{0,6}$/i
    }
  ]"
/>

More info and examples can be found at the official documentation.

License

MIT

Related Packages

@vueform/builder-nuxt

Nuxt module for Vueform Builder

8,690 1
@vueform/core

Headless, schema-driven form framework core for Vue 3 — elements, validation, co...

136 0
@vueform/primevue

PrimeVue adapter for Vueform — build Vueform forms from PrimeVue components.

125 0
@vueform/ui

Styled, themeable Vueform UI component layer built on @vueform/core.

113 0
@vueform/multiselect

Vue 3 multiselect component with single select, multiselect and tagging options.

5,205,764 828

Version History

Version Released Vue License
1.0.7 ^3.4.19 MIT
1.0.6 ^3.4.19 MIT
1.0.5 ^3.4.19 MIT
1.0.4 ^3.4.19 MIT
1.0.3 ^3.4.19 MIT