I'm playing with material ui and build a project and I needed make a TextField with mask with react-imask:
https://mui.com/en/material-ui/react-text-field/#integration-with-3rd-party-input-libraries
But I tried with OutlinedInput but the label crashes:
<FormControl variant="standard">
<InputLabel htmlFor="formatted-text-mask-input">react-imask</InputLabel>
<OutlinedInput
value={values.textmask}
onChange={handleChange}
name="textmask"
id="formatted-text-mask-input"
inputComponent={TextMaskCustom as any}
/>
</FormControl>
Empty
Filled
Codesandbox box
https://codesandbox.io/s/problem-with-3rd-party-input-libraries-cygxss?file=/demo.tsx
Codesandbox result link: https://cygxss.csb.app/


Is there any reason you don't just use a
TextFieldwithvariantset to "outlined"?The MUI example is just showing different methods of using their components and the
FormControlcomposition is done in greater complexity withinTextField.Solution
Brief Look at Form Control
It appears as though you have an
OutlinedInputbut are telling theFormControlit is "standard", fixing this puts the label in the right spot, but it does not properly break the border of the fieldset as intended.If you need to manually control the composition of the individual parts (
FormControl,InputLabel,OutlinedInput, etc) you can see how MUI composeTextFieldin GitHub.