Skip to content

[pickers] Styles applied to MuiPickersDay-dayOutsideMonth actually applied to MuiPickersDay-root #20674

@krizpoon

Description

@krizpoon

Steps to reproduce

Steps:

  1. Create a custom theme using createTheme and override the MuiPickersDay component with a dayOutsideMonth style (for example, change the background color or text color).
const theme = createTheme({
  components: {
    MuiPickersDay: {
      styleOverrides: {
        dayOutsideMonth: {
          border: '1px solid red',
        },
      },
    },
  },
});
  1. Wrap a date picker component (e.g., DatePicker from @mui/x-date-pickers) with a ThemeProvider that uses this custom theme.
  2. Render the date picker and open its calendar view.
Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: pickersChanges related to the date/time pickers.status: waiting for maintainerThese issues haven't been looked at yet by a maintainer.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions