Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pickers] Change days of the week styling #16419

Open
amcmilne opened this issue Jan 31, 2025 · 2 comments
Open

[pickers] Change days of the week styling #16419

amcmilne opened this issue Jan 31, 2025 · 2 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! customization: css Design CSS customizability status: waiting for author Issue with insufficient information support: docs-feedback Feedback from documentation page

Comments

@amcmilne
Copy link

amcmilne commented Jan 31, 2025

Related page

https://mui.com/x/react-date-pickers/date-picker/

Kind of issue

Other

Issue description

How do you target the Days of the Week (S M T W T F S) to changes the styling. I've tried targeting [& .{dayCalendarClasses.weekDayLabel}]: {} in several ways without luck.

Context

I would like to change the font size, color, and family.

Search keywords: days of the week

@amcmilne amcmilne added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Jan 31, 2025
@oliviertassinari oliviertassinari added component: pickers This is the name of the generic UI component, not the React module! customization: css Design CSS customizability labels Jan 31, 2025
@oliviertassinari oliviertassinari changed the title Change days of the week styling [pickers] Change days of the week styling Jan 31, 2025
@michelengelen
Copy link
Member

Well, this does work for me:

import * as React from 'react';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { DateCalendar, dayCalendarClasses } from '@mui/x-date-pickers/DateCalendar';

export default function BasicDateCalendar() {
  return (
    <LocalizationProvider dateAdapter={AdapterDayjs}>
      <DateCalendar
        sx={{
          [`& .${dayCalendarClasses.weekDayLabel}`]: {
            color: 'red',
          },
        }}
      />
    </LocalizationProvider>
  );
}
Image

Did you maybe have a typo somewhere?

@michelengelen michelengelen added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 6, 2025
@LukasTy
Copy link
Member

LukasTy commented Feb 6, 2025

There could have been an issue of where the sx prop is defined.
Doing the above on DatePicker won't work, because the sx prop is propagated to the Text Field.
You can find examples of how to override certain parts of Pickers components here.
Consider using the theme to override certain parts, as it's the most straightforward way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! customization: css Design CSS customizability status: waiting for author Issue with insufficient information support: docs-feedback Feedback from documentation page
Projects
None yet
Development

No branches or pull requests

4 participants