material-ui
material-ui copied to clipboard
Add variant to TextField
In TypeScript there is no way to add variant to TextField, there is no TextFieldPropsVariantOverrides
or BaseTextFieldPropsVariantOverrides
Is there any temporary workaround?
declare module '@mui/material/TextField' {
interface TextFieldPropsVariantOverrides {
dashed: true;
}
}
@mnajdova, you're more familiar with this area. Would you mind checking this?
The TextField
component does not support the dynamic variants, as the structure of the component depends on this prop - for e.g. different input component is rendered based on the variant
prop. We are tracking this issue in https://github.com/mui/material-ui/issues/22259, please upvote it.
Related to https://github.com/mui/material-ui/issues/37846
declare module '@mui/material/TextField' { interface TextFieldPropsVariantOverrides { dashed: true; } } this module is depricated
using this example import { TextField, TextFieldProps } from "@mui/material"; interface CustomTextField {} export const CustomTextField: FC<TextFieldProps & CustomTextField> = ({ className, ...props }) => { return <TextField className={clsx(styles.root, className)} {...props} />; };