@lbtek/input-masks
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

input-masks

Masks for input fields in forms.

Description

This is a utility lib that provides mask functions for inputs, it is necessary to reference these functions in the keyup event (Only in the 'keyup' event) in inputs type="text" (Give preference to type text) to achieve the desired mask effect.

Installation

$ npm i @lbtek/input-masks
# or
$ yarn add @lbtek/input-masks

Use

Available mask functions:

  • cepMask
  • cpfMask
  • cnpjMask
  • cpfCnpjMask
  • phoneMask

Example of basic use:

Use in a front-end project with resolution of importing modules through nodejs.

<input type="text" id="randomInput">

<script>
  import { cpfCnpjMask } from '@lbtek/input-masks'

  document.getElementById('randomInput')
    .addEventListener('keyup', cpfCnpjMask)
</script>

Attention!

To avoid problems with two-way data binding in vue components, you should use the 'lazy' modifier in v-model

To report a problem or suggestion, just open an issue in the repository.

This is an open source project, feel free to collaborate with the development of improvements 🤓.

Readme

Keywords

Package Sidebar

Install

npm i @lbtek/input-masks

Weekly Downloads

0

Version

1.1.3

License

ISC

Unpacked Size

10.4 kB

Total Files

17

Last publish

Collaborators

  • luanrafael