Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Support custom variant to TextField #37846

Open
sm2017 opened this issue Jul 6, 2023 · 4 comments
Open

[TypeScript] Support custom variant to TextField #37846

sm2017 opened this issue Jul 6, 2023 · 4 comments
Assignees
Labels
component: text field This is the name of the generic UI component, not the React module! typescript

Comments

@sm2017
Copy link

sm2017 commented Jul 6, 2023

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;
  }
}
@zannager zannager added component: text field This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jul 7, 2023
@michaldudak
Copy link
Member

@mnajdova, you're more familiar with this area. Would you mind checking this?

@michaldudak michaldudak assigned mnajdova and unassigned michaldudak Jul 11, 2023
@mnajdova
Copy link
Member

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 #22259, please upvote it.

@mnajdova mnajdova removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jul 18, 2023
@mnajdova
Copy link
Member

Related to #37846

@Parvin-Gasimli
Copy link

Parvin-Gasimli commented Apr 29, 2024

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} />;
};

@siriwatknp siriwatknp changed the title Add variant to TextField [TypeScript] Support custom variant to TextField Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! typescript
Projects
None yet
Development

No branches or pull requests

6 participants