Material-ui: Add examples of interoperability with styled-jsx to the docs

Created on 27 Apr 2020  路  4Comments  路  Source: mui-org/material-ui

Hi!

Given that NextJS comes with styled-jsx by default and that MUI already has a pretty great example showcasing how to use MUI with NextJS I think it would be natural to have such type of example.

  • [X] I have searched the issues of this repository and believe that this is not a duplicate.

Summary 馃挕

The thing I think would be most helpful to solve in examples would be:

  • What is the best way to style MUI components with style-jsx?

    • Is the resolve tag the way to go?

    • Or is it a combination of makeStyles from MUI and the css tag from styled-jsx?

  • I've been trying to do just that but I don't seem to be able to change styles for a Drawer for example.

Motivation 馃敠

To be honest I've been having trouble myself trying to make things work between styled-jsx and MUI so having clear examples on how to do so would be incredibly helpful.

Thank you

docs external dependency

Most helpful comment

All 4 comments

Duplicate of #20776?

Hey @oliviertassinari thanks for chiming in!

I don't think it is a duplicate because the current issue discusses an addition to the docs. Perhaps in said example there will be the need to have <StylesProvider injectFirst> in order for it to work correctly. But as a whole #20776 would only be a part of the current issue.

What do you think?

Hi
I experiance the same trouble as fillipvt. I use next js and therefore style-jsx. Using resolve feels kind of wrong. I would also like to avoid to use makeStyles in some parts of the code and in others.

Is there a way to do something like this?

<>
   <Typography component="p" className="bla">text</Typography>
   <style jsx>{`
        .bla {
          background: red;
        }
   `}</style>
</>

Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anthony-dandrea picture anthony-dandrea  路  3Comments

rbozan picture rbozan  路  3Comments

ericraffin picture ericraffin  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

ghost picture ghost  路  3Comments