1.0.1 • Published 1 year ago

react-cpf-cnpj-input-field v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-cpf-cnpj-input-field

A React input component with dynamic mask for Brazilian CPF or CNPJ documents

NPM

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

NameDescriptionDefault
styleCustom stylesundefined
alwaysShowMaskDefine whether to always show the maskfalse
defaultMaskTypeAccepted ("CPF", "CNPJ")"CPF"
asYou can provide a custom inputundefined

License

MIT © rafaelguinho

1.0.1

1 year ago

1.0.0

1 year ago