eduardoborges / use-mask-input

✏️ A react Hook for build elegant input masks. Compatible with React Hook Form
https://npmjs.com/package/use-mask-input
332 stars 19 forks source link

How to use Alternator Masking with cpf and cnpj #94

Closed ronniegchagas closed 1 month ago

ronniegchagas commented 1 month ago

Hi,

i'd to use two alias masks, cpf and cnpj, but it doesn't work

here's my code

<FormField
  control={form.control}
  name="faturamento.cpfCnpj"
  render={({ field }) => (
    <FormItem className="md:col-span-6 col-span-12">
      <FormLabel>CPF/CNPJ</FormLabel>
      <FormControl
        ref={withMask(["999.999.999-99", "99.999.999/9999-99"])}
      >
      <Input placeholder="" {...field} />
      </FormControl>
      <FormMessage />
    </FormItem>
  )}
/>

how's the correct form to use ?

** i use shadcn with next14

ronniegchagas commented 1 month ago

sorry, but after restart server it's work!

this package is awesome!