react-cpf-cnpj-input-field
v1.0.1
Published
A React input component with dynamic mask for Brazilian CPF or CNPJ documents
Downloads
65
Readme
react-cpf-cnpj-input-field
A React input component with dynamic mask for Brazilian CPF or CNPJ documents
Table of Contents
Install
npm install --save react-cpf-cnpj-input-field
Usage
import React from 'react'
import CpfCnpjInput from 'react-cpf-cnpj-input-field'
const App = () => {
render() {
return <CpfCnpjInput />
}
}
Usage with React Hook Form
<Controller
control={control}
name='cpf_cnpj'
render={({ field: { onChange, onBlur, value, name } }) => (
<CpfCnpjInput
onBlur={onBlur}
onChange={onChange}
checked={value}
name={name}
/>
)}
/>
Properties
Name | Description | Default ---|---|--- style | Custom styles | undefined alwaysShowMask | Define whether to always show the mask | false defaultMaskType | Accepted ("CPF", "CNPJ") | "CPF" as | You can provide a custom input | undefined
License
MIT © rafaelguinho