I’m working on a project using Material UI (MUI) and specifically the DateTimePicker component from the @mui/x-date-pickers package. I’d like to change the colors of the AM/PM buttons.
MUI often abstracts styling details and that you have to target specific classnames through the sx props, and while I’ve checked the documentation, I haven’t found a clear way to target these buttons for color customization.
Has anyone encountered this before and found a solution to style the AM/PM buttons in MUI’s DateTimePicker? Any guidance or suggestions would be greatly appreciated!
2
Answers
I have not used this package, but you can use "multi date picker", it is a powerful tool and has the ability to customize.
I don’t have a working example right now but
.MuiDateTimePickerToolbar-ampmSelection
is the class you can target to style AM/PM section.https://mui.com/x/api/date-pickers/date-time-picker-toolbar/#classes
Hope this helps.
Also given that you are new here as a fellow newbie to StackOverflow I would suggest you create a sandbox or post minimum reproducible code whenever possible. Would allow others to see and debug your issue.