-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
[Box] Remove render prop #26113
[Box] Remove render prop #26113
Conversation
Let’s also add in the breaking changes of how we can also apply this on the intrinsic elements, for example using the -<Box sx={{ border: '1px dashed grey' }}>
- {(props) => <button {...props}>Save</button>}
-</Box>
+<Box component='button' sx={{ border: '1px dashed grey' }} /> |
To workaround the problem, you have two options: | ||
|
||
1. Use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is Material-UI component | ||
To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would here also mention the component
prop for the non Material-UI components.
a703a37
to
68234a4
Compare
68234a4
to
c50f6e4
Compare
At some point, I have wondered if it wouldn't make sense to keep the render prop API for when customizing third-party components, but forcing the developer down the On a different note, the documentation page of the Box could maybe be improved. What about the following proposal?
|
It's explained in "Overriding Material-UI components". I agree that this section should be removed or converted to describe how to use the These small updates in the docs I'll do in another PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Breaking changes
[Box] Remove the render prop because its behavior can be obtained using the
sx
prop directly on the child if it's a Material-UI component. For non-Material-UI components use thesx
prop in conjunction with thecomponent
prop:Part of #20012.
A follow up of #26031. #26031 (comment)
https://deploy-preview-26113--material-ui.netlify.app/components/box