mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[pickers][DatePicker] change borderRadius of selected day for dateCalendar

Open ImamJanjua opened this issue 9 months ago β€’ 9 comments

Steps to reproduce

No response

Current behavior

No response

Expected behavior

No response

Context

Hi, I am trying to change the borderRadius for the days which are been selected or like the todays day, but not working for me

<DateCalendar
  {...props}
  slots={{
    leftArrowIcon: LeftArrowIcon,
    rightArrowIcon: RightArrowIcon,
  }}
  slotProps={{
    day: {
      sx: {
        "::selection": {
          borderRadius: "10px",
        },
      },
    },
  }}
/>

Your environment

No response

Search keywords: .

ImamJanjua avatar May 11 '24 10:05 ImamJanjua

@ImamJanjua is this something that you are looking for? πŸ€” Consider checking the customization playground for more examples. πŸ˜‰

LukasTy avatar May 13 '24 07:05 LukasTy

@LukasTy thanks man!

another thing, calendar is not responsive at all and appears to have fixed dimension, does it have something to do with the breakpoints?

https://github.com/mui/mui-x/assets/137432044/1f2a7427-2dbd-41d4-9922-89c4b1892d58

ImamJanjua avatar May 13 '24 08:05 ImamJanjua

another thing, calendar is not responsive at all and appears to have fixed dimension, does it have something to do with the breakpoints?

Yes, the calendar has a fixed width just as the material design suggests. Do you have suggestions on how to make it responsive? πŸ€”

LukasTy avatar May 13 '24 10:05 LukasTy

@LukasTy shouldn't u know that? πŸ˜„

ImamJanjua avatar May 13 '24 10:05 ImamJanjua

shouldn't u know that? πŸ˜„

Well, that's basically an answerβ€”we don't know of a good way to make the calendar UX friendly and responsive, that's why it has the same fixed width as the material design suggests. It's enough to fit in the portrait orientation of all the modern smallest mobile devices, so, it seems to do the trick. πŸ€”

LukasTy avatar May 13 '24 11:05 LukasTy

@LukasTy does the calendar has breakpoints and can i acess and modify them?

ImamJanjua avatar May 13 '24 11:05 ImamJanjua

does the calendar has breakpoints and can i acess and modify them?

No, there are no explicit breakpoints that are used. If you want to use the theme breakpoints, then access them and override the styles accordingly. πŸ‘

LukasTy avatar May 13 '24 12:05 LukasTy

@LukasTy thanks!

do u may know how can change the view with custom header?

const DateCalendar: React.FC<DateCalendarProps<Date>> = (props) => {

  const Header = () => {
    return (
      <div className="flex flex-row justify-center gap-8 ">
         {/* on press go to next month*/}
        <button>
          <ChevronLeft size={22} />
        </button>
          
          {/* on press go to today*/}
        <button>today</button>

        {/* on press go to previous month*/}
        <button>
          <ChevronRight size={22} />
        </button>
      </div>
    );
  };

  return (
    <ThemeProvider theme={theme}>
      <Calendar
        slots={{
          calendarHeader: Header,
        }}                   />
   
  );
};

ImamJanjua avatar May 13 '24 17:05 ImamJanjua

@LukasTy thanks!

do u may know how can change the view with custom header?

const DateCalendar: React.FC<DateCalendarProps<Date>> = (props) => {

  const Header = () => {
    return (
      <div className="flex flex-row justify-center gap-8 ">
         {/* on press go to next month*/}
        <button>
          <ChevronLeft size={22} />
        </button>
          
          {/* on press go to today*/}
        <button>today</button>

        {/* on press go to previous month*/}
        <button>
          <ChevronRight size={22} />
        </button>
      </div>
    );
  };

  return (
    <ThemeProvider theme={theme}>
      <Calendar
        slots={{
          calendarHeader: Header,
        }}                   />
   
  );
};

see this #13116 ... is this issue resolved and can be closed @ImamJanjua?

michelengelen avatar May 14 '24 10:05 michelengelen

The issue has been inactive for 7 days and has been automatically closed.

github-actions[bot] avatar May 21 '24 15:05 github-actions[bot]