I have incorporated an icon into the slot parameter within the Datepicker of the Material-UI (MUI) framework in order to modify it.
This addition was successfully implemented. However, a challenge arises as the Datepicker fails to unveil upon clicking either the appended icon or the input field.
How may I address and rectify this circumstance?
<DatePicker
label="Filled picker"
slotProps={{ textField: { variant: "filled" } }}
slots={{ openPickerButton: () => <img src="./icon" /> }}
/>
You have to pass the props of openPickerButton
to your custom element:
DatePicker
{...otherProps}
slots={{ openPickerButton: ({ children, ...props }) => <img {...props} src="./icon" /> }}
/>