-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[material-ui] Remove display="block"
usage to work with Pigment CSS
#43307
Conversation
Netlify deploy previewhttps://deploy-preview-43307--material-ui.netlify.app/ FormControlLabel: parsed: -3.75% 😍, gzip: -3.12% 😍 Bundle size reportDetails of bundle changes (Toolpad) |
In order to avoid a bigger breaking change, can we just update the prop to have some of the valid CSS values and support it:
And document that if people used the breakpoints syntax only in those cases they should use the CSS var approach. What do you think about it? I mean it has a discrete set of values, we could still support at least these values. |
I'm not sure about having a CSS var as part of the component API. Looks like introducing a new approach that's not followed in other parts of Material UI. I think we should think about this a bit more before proceeding. What other alternatives do we have? Can we recommend using the |
How about adding I don't think we should add all possible values for the Using this approach creates too many classes that are likely not used. |
I think a If we introduce a breaking change (removing the Otherwise, I'd suggest doing
If it's acceptable to remove the |
I found a way to fix it without introducing any CSS var or props, using What do you think about 43c3ae1 @aarongarciah @mnajdova ? |
@siriwatknp I'm assuming Emotion users can keep using |
Why not using Because we don't have a way to make it work with both Emotion and Pigment CSS. Let's say we use // CardHeader.js
<Typography
- display="block"
{…titleTypographyProps}
+ sx={[
+ { display: 'block' },
+ …Array.isArray(titleTypographyProps?.sx) ? titleTypographyProps?.sx : [titleTypographyProps?.sx]
+ ]}
> The above code works with Emotion, but not with Pigment CSS (yet). |
Issue
There are some components that are using deprecated system props,
display="block"
.This produces incorrect behavior when using Pigment CSS. Below is an example of rendering
<CardHeader title="…" subheader="…">
:Emotion:
Pigment CSS
Solution
The best solution that I found so far is to use CSS variables (the same approach I used with Joy UI).
The Typography component has a display of
var(--Typography-display)
so that other components can control the display without creating higher CSS specificity.