/
This mask is based on the libphonenumber-js package.
UsemaskitoPhoneOptionsGenerator
to create a mask for phone input. For validating phone number you can use isValidPhoneNumber
, isPossiblePhoneNumber
functions from libphonenumber-js package. Read more
Below is an example of a Hungarian phone mask with an angular validator.
Setting the strict
option to false
enables non-strict mask mode and allow user to type any country phone number.
The countryIsoCode
option is optional in that case, but if you specify it, the mask will try to add that country's calling code when you try to insert a phone number without a calling code.
You can load metadata lazily, below is an example of how to do it in Angular.
You can also customize the metadata to reduce metadata size. See instructions here
maskitoAddOnFocusPlugin
/ maskitoRemoveOnBlurPlugin
to mutate textfield's value on focus/blur events.