-
-
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
[Box] Add sx prop #23053
[Box] Add sx prop #23053
Conversation
…into feat/box-sx-prop
@eps1lon agree I will create a follow up PR deprecate the existing Box props in favor of The next related PRs will be for deprecating the props and improving the system documentation
@oliviertassinari let me create issues for the problems you've found so that we can tackle them one by one. I fixed the number 3. but there are still related issues with the breakpoints - #16528 that will be solved separately. I want to keep this PR solely for adding support for the sx prop, otherwise it will grow too big too fast :) |
@oliviertassinari here is a summary for the issues:
Reported #23187
Not sure what we expect to happen here, but let me open an issue on it after we have the
Partially fixed, #16528 is relevant for the rest of the issue
Let me open an issue on this after we have the support for the
Agree, let me open an issue on this after the have the
Reported #23190
Reported #23188
I wouldn't change anything regarding it at this moment, but we could create an RFC to ask what people think. I think the spacing is usually a small value instended to be used for paddings/margins, not sure how much it would make sense with something like width/height. But maybe we can have some
Reported #23192
Left comment with this use case on the issue as well. |
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.
Great! I think that we are going in the right direction with this :)
Description
This PR adds the support for
sx
prop on theBox
component. It is inspired by Theme UI'ssx
prop.Motivation
The Box component currently supports a restricted set of CSS properties on its props API. Most of these properties, which are part of the design system are mapped to specific keys inside the theme. While these properties are useful and allow clean API for the most common scenarios, we don't have support for all CSS props, which makes developers inconsistently use some of them as props, and some of them via external classes defined differently.
In order to solve this problem, we are adding additional property
sx
, which supports inside all system props that are available as props, but also all other CSS properties. In addition to this, the breakpoints API, which is available as object or array:is available on all properties, system and regular CSS.
Another problem that we are solving with this is, allowing developers to define system props on pseudo-elements & selectors.
We expect with this change, that developers will move to the
sx
prop for defining all styles for the Box as one recommended way to be used. In a follow up PR we will deprecate the existing Box system properties.Here is an example:
TODO:
Closes #17297