You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to add a new prop and customize it, TS will still complain this prop doesn't exist. The documentation lack some examples on how to add new props, it only shows how to add new variants. I tried with:
I'm trying to add a new prop to a component and customize it. I don't want to wrap this component in a new custom component, I want to use the component directly from MUI with my customized theme
You cannot just add new props to the components, it has an implication to the run time, for example it would add the prop directly on the DOM element regardless of whether it is a valid HTML attribute. It is intentional that only variants, sizes and colors can be extended.
I'm trying to add a new prop to a component and customize it. I don't want to wrap this component in a new custom component, I want to use the component directly from MUI with my customized theme
If you really want to do this, you can use some data-attrbite, but I would really not recommend this, as the prop would end up on the DOM elements.
@mnajdova, are there any plans to add variant prop to components like IconButton that don't have it now? I was trying to customize IconButton via MUI theme by adding custom variants, but discovered there is no variant prop.
@mnajdova, are there any plans to add variant prop to components like IconButton that don't have it now? I was trying to customize IconButton via MUI theme by adding custom variants, but discovered there is no variant prop.
Not at this moment, but for this specific component I would propose creating new issue with a feature request, and we talk about it there.
Duplicates
Latest version
Current behavior 😯
When trying to add a new prop and customize it, TS will still complain this prop doesn't exist. The documentation lack some examples on how to add new props, it only shows how to add new variants. I tried with:
I also tried changing the
TableRowProps
toTableRowPropsOverrides
, but it still the same.I added the prop to my theme to style it:
I don't have any TS error on my theme override, but when using the component, TS throws an error saying the
clickable
prop doesn't exist:Expected behavior 🤔
TS would allow this new added prop to the component
Steps to reproduce 🕹
I created a codesandbox replicating the issue: https://codesandbox.io/s/mui-tablerow-wjem8?file=/src/App.tsx
Context 🔦
I'm trying to add a new prop to a component and customize it. I don't want to wrap this component in a new custom component, I want to use the component directly from MUI with my customized theme
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: