react-input-mask icon indicating copy to clipboard operation
react-input-mask copied to clipboard

Plugin does not work with shadcn Input component

Open dinogit opened this issue 2 years ago • 0 comments
trafficstars

Description:

  • When using https://ui.shadcn.com/docs/components/input with react-input-mask, it does not mask the input

Steps to Reproduce:

  • Install ui.shadcn.com with Vite. Add this code:
const { getInputProps } = useInputMask({
    mask: 'One does not simply walk into AAAAAA',
  });

  return (
    <div>
      <h1>Overview</h1>
      <div className="w-[240px] mt-12">
        <Label>Label</Label>
        <Input name="number" {...getInputProps} onChange={e => {
          // Your onChange handler gets the output of the hook (won't trigger if the input is invalid)
          console.log(e.target.value);
        }} />
      </div>

    </div>
  );

Expected Behavior:

  • Input should be masked

Actual Behavior:

  • Input is not masked

Error message: No error message.

Note: Update documentation. Import only functions if :

import { useInputMask } from '@code-forge/react-input-mask';

dinogit avatar Sep 05 '23 12:09 dinogit