What is inputmask?
The inputmask npm package is a versatile library that allows developers to create input masks for form fields. This helps in formatting user input in a predefined manner, ensuring data consistency and improving user experience.
What are inputmask's main functionalities?
Date Input Mask
This feature allows you to create a date input mask. The example code formats the input to 'dd/mm/yyyy'.
const Inputmask = require('inputmask');
Inputmask({ alias: 'datetime', inputFormat: 'dd/mm/yyyy' }).mask(document.querySelector('#date-input'));
Phone Number Input Mask
This feature allows you to create a phone number input mask. The example code formats the input to '(999) 999-9999'.
const Inputmask = require('inputmask');
Inputmask({ mask: '(999) 999-9999' }).mask(document.querySelector('#phone-input'));
Currency Input Mask
This feature allows you to create a currency input mask. The example code formats the input to include a dollar sign prefix.
const Inputmask = require('inputmask');
Inputmask({ alias: 'currency', prefix: '$ ' }).mask(document.querySelector('#currency-input'));
Email Input Mask
This feature allows you to create an email input mask. The example code ensures the input follows a valid email format.
const Inputmask = require('inputmask');
Inputmask({ alias: 'email' }).mask(document.querySelector('#email-input'));
Other packages similar to inputmask
cleave.js
Cleave.js is a JavaScript library for formatting input text content when you are typing. It offers similar functionalities to Inputmask, such as date, phone number, and credit card formatting. However, Cleave.js is known for its simplicity and ease of use.
vanilla-text-mask
Vanilla Text Mask is a pure JavaScript input mask library. It provides similar functionalities to Inputmask, including support for various input formats like dates, phone numbers, and currency. Vanilla Text Mask is often praised for its flexibility and integration with React, Angular, and Vue.
imaskjs
IMask is a JavaScript library for creating input masks. It offers a wide range of features similar to Inputmask, such as date, number, and custom masks. IMask is known for its performance and ability to handle complex masking scenarios.
Inputmask
Copyright (c) 2010 - 2023 Robin Herbots Licensed under the MIT license (https://opensource.org/licenses/MIT)
The Inputmask has a very permissive license and this will stay that way. But when you use the Inputmask in a commercial setting, be so honest to make a small donation.
This will be appreciated very much.
Inputmask is a javascript library that creates an input mask. Inputmask can run against vanilla javascript, jQuery, and jqlite.
An inputmask helps the user with the input by ensuring a predefined format. This can be useful for dates, numerics, phone numbers, ...
Thanks to Jetbrains for providing a free license for their excellent Webstorm IDE.
Thanks to Browserstack for providing a free license, so we can automate testing in different browsers and devices.
Documentation and demo page
https://robinherbots.github.io/Inputmask/