-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Steps to reproduce
Steps:
- Create a custom theme using
createThemeand override theMuiPickersDaycomponent with adayOutsideMonthstyle (for example, change the background color or text color).
const theme = createTheme({
components: {
MuiPickersDay: {
styleOverrides: {
dayOutsideMonth: {
border: '1px solid red',
},
},
},
},
});- Wrap a date picker component (e.g.,
DatePickerfrom@mui/x-date-pickers) with aThemeProviderthat uses this custom theme. - Render the date picker and open its calendar view.
Current behavior
The styles defined in the dayOutsideMonth override were applied to .MuiPickersDay-root elements, but not to the .MuiPickersDay-dayOutsideMonth elements.
Expected behavior
The dayOutsideMonth style applied to days outside the current month.
Context
I'm trying to customize the MUI Date and Time pickers so that days outside the current month have a distinct style (for example, a faded color). I used the createTheme API to add a styleOverrides entry for MuiPickersDay.dayOutsideMonth. Despite specifying a style only for dayOutsideMonth, the custom style is being applied to every .MuiPickersDay-root element. I would like the dayOutsideMonth style to apply exclusively to days outside the current month.
Your environment
npx @mui/envinfo
System:
OS: macOS 26.1
Binaries:
Node: 22.21.1 - /Users/kwokcheung.poon/.asdf/installs/nodejs/22.21.1/bin/node
npm: 11.6.4 - /Users/kwokcheung.poon/dev/nokkel/nokkel-core/node_modules/.bin/npm
pnpm: Not Found
Browsers:
Chrome: 143.0.7499.41
Edge: Not Found
Firefox: 145.0.2
Safari: 26.1
npmPackages:
@emotion/react: ^11.14.0 => 11.14.0
@emotion/styled: ^11.14.1 => 11.14.1
@mui/core-downloads-tracker: 7.3.6
@mui/material: ^7.3.6 => 7.3.6
@mui/private-theming: 7.3.6
@mui/styled-engine: 7.3.6
@mui/system: 7.3.6
@mui/types: 7.4.9
@mui/utils: 7.3.6
@mui/x-date-pickers: ^8.22.0 => 8.22.0
@mui/x-internals: 8.22.0
@types/react: ^18.2.67 => 18.3.27
react: 18.3.1
react-dom: 18.3.1
typescript: 5.5.4 => 5.5.4
Browser used: Chrome
Search keywords: MuiPickersDay dayOutsideMonth style