@comparaonline/ui-text-masks

> Package purpose

Usage no npm install needed!

<script type="module">
  import comparaonlineUiTextMasks from 'https://cdn.skypack.dev/@comparaonline/ui-text-masks';
</script>

README

@comparaonline/ui-text-masks

Package purpose

Installation


yarn add @comparaonline/ui-text-masks

Usage

You need import from ui-text-mask the withTextMask HOC and passing a valid mask. You can import a predefined mask from ui-text-mask or make your custom one. If you want use a custom mask, be careful to implement maskArray type from 'react-text-mask' to complete a valid mask.

Here is the list of predefined masks:

  • CNPJ
  • CEP
  • CPF
  • CellPhone
  • BirthDay
import React from 'react';
import { withTextMask, CNPJ } from '@comparaonline/ui-text-masks';

const CNPJInputMask = withTextMask(CNPJ);

export const RenderCNPJInputMask: React.SFC = () => <CNPJInputMask />