-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
[RFC] Remove sx-like props #41539
Comments
Previously, I have suggested the exact opposite, which is to allow other components to make use of sx-like props #37677. But then some one pointed out this can be hard to do on components that already have props of the same name. So I believe this RFC is the 2nd best option for consistency. However, if we are going towards this route, I think MUI should provide a |
What do you mean by |
Basically the logic of https://mui.com/system/getting-started/the-sx-prop/#passing-the-sx-prop. That's why a util function like this exists: https://github.com/RobinTail/merge-sx |
As long as there's a codemod that can be used to convert all of our existing like props, I think this is a good move. |
Removing those makes sense to me. I personally never use them, and they will be hard to support for Pigment CSS. Having one prop dedicated to styles makes sense, e.g. On the execution, it seems that it should be deprecated in Material UI v6, without support for Pigment CSS and then removed in Material v7. It feels too much of a pain/brutal to remove them without a deprecation phase and even with codemods. |
I think it's better to do breaking change than deprecations given that the sx-like props are in some components. It would reduce a lot of complexity on our side. |
@siriwatknp We are paying for the complexity today, and we won't do the effort to make it work Pigment CSS. As much as it would be great to just remove stuff in one major, I don't think that it's how we should operate, as a user, it would make it feel that we are disconnected from real-life projects and reinforce that "when you use something by MUI, you subscribe to costly migrations". Instead, I think that spaning changes in two majors and make more frequent majors would be great.
@mwskwong I have found the issue in question: #37677. I'm moving the conversation there 👍 |
A relevant work on this https://primer.style/react/system-props
For context primer/react#1336. We could copy their codemod. |
The team agreed to do this so I'm closing this issue. Follow #42259 for the next step. |
Context
Example of sx-like props:
These components currently support sx-like props:
Problems
sx
prop. we should not have multiple APIs that do the same thing.sx
prop and sx-like props. Copy-paste from one to another is frustrated.Proposal
Remove the sx-like props from all of the components and always use
sx
prop on Material UI component. Thesx
prop already indicates that there is something specific to the library, not React or HTML things.There will be no deprecation since there are not a lot of components in the list. All of them will be updated in a single PR.
The text was updated successfully, but these errors were encountered: