0.11.1 • Published 7 years ago

vue-the-mask v0.11.1

Weekly downloads
67,903
License
MIT
Repository
-
Last release
7 years ago

The Mask

A lightweight (2KB gzipped) and dependency free mask input created specific for Vue.js

Docs and Demo

JsFiddle

The Mask Heart

Install

yarn add vue-the-mask
or
npm i -S vue-the-mask

Usage (two flavors)

Global

import VueTheMask from 'vue-the-mask'
Vue.use(VueTheMask)

Local (inside the component)

import {TheMask} from 'vue-the-mask'
export default {
  components: {TheMask}
}

Local (as directive)

import {mask} from 'vue-the-mask'
export default {
  directives: {mask}
}

Tokens

'#': {pattern: /\d/},
'X': {pattern: /[0-9a-zA-Z]/},
'S': {pattern: /[a-zA-Z]/},
'A': {pattern: /[a-zA-Z]/, transform: v => v.toLocaleUpperCase()},
'a': {pattern: /[a-zA-Z]/, transform: v => v.toLocaleLowerCase()},
'!': {escape: true}

The Mask Money

Properties

PropertyRequiredTypeDefaultDescription
valuefalseStringInput value or v-model
masktrueString, ArrayMask pattern
maskedfalseBooleanfalseemit value with mask chars, default is raw
placeholderfalseStringSame as html input
typefalseString'text'Input type (email, tel, number, ...)
tokensfalseObjecttokensCustom tokens for mask

What about money?

We understand that money format is a totally different domain, which needs another specific component. You can use https://github.com/vuejs-tips/v-money

The Mask Money

Other Solutions

  1. https://github.com/nosir/cleave.js https://github.com/nosir/cleave.js
  2. https://github.com/text-mask/text-mask https://github.com/text-mask/text-mask
  3. https://github.com/igorescobar/jQuery-Mask-Plugin https://github.com/igorescobar/jQuery-Mask-Plugin
  4. https://github.com/fernandofleury/vanilla-masker https://github.com/fernandofleury/vanilla-masker
  5. https://github.com/angular-ui/ui-mask https://github.com/angular-ui/ui-mask
  6. https://github.com/insin/inputmask-core https://github.com/insin/inputmask-core
  7. https://github.com/niksmr/vue-masked-input https://github.com/niksmr/vue-masked-input
  8. https://github.com/probil/v-mask https://github.com/probil/v-mask
  9. https://github.com/moip/awesome-mask https://github.com/moip/awesome-mask
  10. https://github.com/the-darc/string-mask https://github.com/the-darc/string-mask
  11. https://github.com/romulobrasil/PureMask.js https://github.com/romulobrasil/PureMask.js
  12. https://github.com/devindex/vue-mask https://github.com/devindex/vue-mask

Currency

  1. https://github.com/vuejs-tips/v-money https://github.com/vuejs-tips/v-money
  2. https://github.com/plentz/jquery-maskmoney https://github.com/plentz/jquery-maskmoney
  3. https://github.com/flaviosilveira/Jquery-Price-Format https://github.com/flaviosilveira/Jquery-Price-Format
  4. https://github.com/kevinongko/vue-numeric https://github.com/kevinongko/vue-numeric

Suggest another one here

Contribution

You're free to contribute to this project by submitting issues and/or pull requests. This project is test-driven, so keep in mind that every change and new feature should be covered by tests. Your name will be added to the hall of fame ;)

The Mask Wolf

License

This project is licensed under MIT License

vue3-nre@mkuchak/vue-flow-form@ixlayer/ixlayer-components@mattiyahu23/vue-ui@albertronics/advanced-vuetifyvue-reboot-uivue-atti-materialmonzemnuxt-boilerplate123-ui-kit-prodinfonaligy-vue-components@infonaligy/inf-vue-componentstotalpass-portal-rh@quizbound/quiz-v2123-ui-kitds-web-platform-clientvue-kit-test321vue-kit-test3212rshb-vue-kitrshb-vue-kit-prodsfvuevue-exbico-materialtechlines-framework-02ship-smart-library@infinitebrahmanuniverse/nolb-vue-thvue-hive-trialvue-hive-trial-ver@everything-registry/sub-chunk-3094@felix-health/vue-components-vue2mv-executor-viewsimpli-web-sdksolydscreen-builderstar-componentzentreeposstorybook-lernadigikit@dhau/vuejs-datepicker@ditdot-dev/vue-flow-formrb-bv-componentsrwc-clientsala-componentssala-components-v2sankhya-web-componentssapitur-toolkit-vueremix-uiremix-ui-literentzilla-componentsreuni-componentse-order-uispa-skeletonsongtracker-prosolutions.dadada.rudock-components@avenuea/chatbulmagic@avto-dev/bank-card-vue-componentbygg-vue-form@awes-io/form-builder@bchteam/typed-inputcarbon-zero-widget_stagingcarbon-zero-widgetoneblink-apps-vuecdcdcneport-core-frontendcneport-wutong-frontendcnetong-apps-base-frontendcnetong-core-frontendportabilis-uiplformplanetcomponents@sysconexao/componentscontacts-modules-huggypre-uicore-user-dash@contactstudio/agent-tools@coredevph/iaccs-basephaidra-vue-componentscentiva-design-systempayone-js-payment-form@burh/nuxt-core@blackwall/typed-input@bcrs-shared-components/contact-infocpsi-ds@braspagteam/braspag-components-vuepdo-themepb-components-vue2braspag-components-vue-mine@auto-euro/ae-tools-lib@aurora-enterprise-solutions/aur-design@devmantris/mantris-vue-bulmadatepickervue2customdatepicker-vue2-recentbedrock-setupbi-vue-phone-mask@aistim/vue3-ui@63pokupki/design-system@aantix/vue-flow-formsuperv-jssupervjs-coresupervjs-nucleo
0.11.1

7 years ago

0.11.0

7 years ago

0.11.0-alpha.2

7 years ago

0.11.0-alpha.1

7 years ago

0.11.0-alpha.0

7 years ago

0.11.0-alpha

7 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.9.0

7 years ago

0.8.0

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago