import * as React from 'react'; import { IMaskInput } from 'react-imask'; import FormControl from '@mui/joy/FormControl'; import FormLabel from '@mui/joy/FormLabel'; import Input from '@mui/joy/Input'; interface CustomProps { onChange: (event: { target: { name: string; value: string } }) => void; name: string; } const TextMaskAdapter = React.forwardRef( function TextMaskAdapter(props, ref) { const { onChange, ...other } = props; return ( onChange({ target: { name: props.name, value } })} overwrite /> ); }, ); export default function InputReactImask() { const [value, setValue] = React.useState('(100) 000-0000'); return ( Label setValue(event.target.value)} placeholder="Placeholder" slotProps={{ input: { component: TextMaskAdapter } }} /> ); }