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

[DatePicker] How to style the popper/dialog with styled (emotion)? #26767

Open
wouter-leistra opened this issue Jun 15, 2021 · 7 comments
Open
Labels
component: date picker This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation

Comments

@wouter-leistra
Copy link

wouter-leistra commented Jun 15, 2021

I've been going through the docs of emotion/styled as well as next.material-ui.com, but I can't find a way to style the dialogs/poppers and their contents. On the docs there is also no styles table for DatePicker API, which complicates things further.

I'm using the v5.0.0-alpha.36 packages for core and lab. Any advice is greatly appreciated.

In the sandbox link below you see that we have a customized theme that adds 4 colors to the palette. But the main question is how to style the popper/dialog with styled, datePicker components do not seem to support classes and therefore the example on how to style portals does not seem to work.

Sandbox:
https://codesandbox.io/s/suspicious-montalcini-k3nhy

@wouter-leistra wouter-leistra added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 15, 2021
@mnajdova
Copy link
Member

@wouter-leistra what do you mean by

in a working way that also Typescript agrees with.

? Please provide a codesandbox that illustrates what is the problem.

@mnajdova mnajdova added package: styled-engine Specific to @mui/styled-engine 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 Jun 15, 2021
@wouter-leistra
Copy link
Author

@wouter-leistra what do you mean by

in a working way that also Typescript agrees with.

? Please provide a codesandbox that illustrates what is the problem.

Sorry, added the sandbox that illustrates our situation.

@wouter-leistra
Copy link
Author

@mnajdova i updated the ticket... I'm still eager to learn how to do this on the datepicker...

@mnajdova
Copy link
Member

Ah, I see your confusion now. This should help you - https://next.material-ui.com/guides/interoperability/#portals Here is a dirty POC codesandbox - https://codesandbox.io/s/focused-fermi-sjcs1?file=/src/App.tsx When component uses portal inside, usually we recommend forwarding the className coming from styled to the portal element.

@mnajdova mnajdova added component: date picker This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation and removed package: styled-engine Specific to @mui/styled-engine status: waiting for author Issue with insufficient information labels Jun 30, 2021
@mnajdova
Copy link
Member

There is a potential in improving the docs around this. Leaving the issue with docs label, so we can address this in the future.

@smmccabe
Copy link

Is there a reason components that use portals can't just automatically forward the classname? I was debugging a tooltip (uses popper) and it took quite a while to figure out what was going wrong and then find the appropriate docs.

@mnajdova
Copy link
Member

The classes are forwarded to the children inside the portal component, so that it would be consistent with the other components (in terms the class name being applied on the root element in the react tree).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date picker This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

No branches or pull requests

3 participants