-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[material-ui][Alert] TS error when using slotProps with customised component #42601
Comments
not found example link T^T |
@appleSimple my bad 😞 |
slotProps's type could be This may be related part of cause.
|
@appleSimple |
You can type cast <Alert
icon={<CheckIcon fontSize="inherit" />}
severity="success"
onClose={() => void 0}
slots={{
closeIcon: CloseIcon,
closeButton: MyIconButton,
}}
slotProps={{
closeButton: {
iconSize: 'medium',
} as MyIconButtonProps,
}}
>
Here is a gentle confirmation that your action was successful.
</Alert> This approach works, but it's not clear if it should be documented as a solution or is considered a workaround in which case this is a bug. |
@ZeeshanTamboli I don't it's possible since |
Hey @alexey-kozlenkov, thanks for the report 😊 This use case is covered in other components by adding This hasn't been implemented in all components, the |
@DiegoAndai have a look please when convenient |
Steps to reproduce
Link to live example: https://codesandbox.io/p/sandbox/damp-monad-sptgfr?file=%2Fsrc%2FDemo.tsx%3A12%2C4
Steps:
slotProps
Current behavior
On example of Alert component (it's likely a common issue):
slots
allow to customisecloseIcon
component to be something else the default IconButton.However, if I set it be some custom component,
slotProps
won't pickup prop types from defined component and keep pointing toIconButtonProps
from mui packageExpected behavior
Complaint types
Context
No response
Your environment
No response
Search keywords: slot slotProps
The text was updated successfully, but these errors were encountered: