text-mask-vat-id
Text Mask function for VAT identification number.
Example
Demo available here: dimitrinicolas.github.io/text-mask-vat-id/example
Installation
npm i text-mask-vat-id
Usage
I recommend you to add an uppercase pipe function to text-mask component:
{ return value;}
With React.js
import React from 'react'import MaskedInput from 'react-text-mask'import createVatIdMask from 'text-mask-vat-id'; const mask = ; <MaskedInput = = />;
In Vanilla JS
Options
You can pass options as an object when creating text mask:
const mask = ;
localeFormat
(default:false
): If the mask should add separation characters (,
-
,.
and/
) to the VAT ID. E.g.:"FR19845015858"
would become"FR 19 845 015 858"
.
Build
Compile with Rollup:
npm run build
Build and test:
npm test
Source
- en.wikipedia.org/wiki/VAT_identification_number
- www.gov.uk/guidance/vat-eu-country-codes-vat-numbers-and-vat-in-other-languages
Related
text-mask
- Input mask for React, Angular, Ember, Vue, & plain JavaScript
License
This project is licensed under the MIT license.