Reputation: 246
I want to change the background colour of selected date in MUI datePicker. As shown in below picture i need to change the blue color to some other color.
Below is my code
const useStyles = makeStyles(theme => ({
datePickerStyle: {
"& .css-bkrceb-MuiButtonBase-root-MuiPickersDay-root.Mui-selected": {
backgroundColor: "red",
color: '#000000'
},
}
<DatePicker
disablePast
value={checkout.rideDate}
shouldDisableDate={getDisabledDates}
onChange={(newValue) => {
dispatch(setRideDate(newValue?.toISOString().split('T')[0]))
}}
renderInput={(params) => <TextField className={classes.datePickerStyle} {...params}
/>
}
Upvotes: 2
Views: 8356
Reputation: 101
I resolved it by passing style in PaperProps like this:
PaperProps={{
sx: {
"& .MuiPickersDay-root": {
"&.Mui-selected": {
backgroundColor: colors.Cerulean,
},
},
https://i.sstatic.net/D8DWw.png
Upvotes: 8