Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass classname to material ui date-picker dialog

Is there a way to pass classname to matererial-ui datepicker's dialog.

http://www.material-ui.com/#/components/date-picker

Material-ui's datepicker accepts classname as a prop. But, this gets applied to the text-field upon which we want to trigger the date-dialog.

I want to pass a class attribute to the date-popup itself. Something like: dialogClassName

The need is I want to access if the click was done somewhere inside the date-dialog and manage some other part of my code based on that. I can't figure out how to make the date-dialog accept a classname.

This issue was a bit boosting,https://github.com/mui-org/material-ui/issues/5329 but passing a dialogClassName doesn't get applied.

like image 780
nitte93 Avatar asked Sep 20 '25 19:09

nitte93


1 Answers

There is a solution which I came across by going through the DatePicker Code. You can pass the following props to the DatePicker

<DatePicker>
    PopperProps={{
                  className: classes.desktopView,
                }}
    DialogProps={{
                  className: classes.mobileView,
                }}
</DatePicker>
like image 196
Shailesh Suyal Avatar answered Sep 22 '25 19:09

Shailesh Suyal