-
Notifications
You must be signed in to change notification settings - Fork 120
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
Consider alternate object syntax for props that accept arrays #431
Comments
One thought is that library level could coalesce the values being passed in the array in a way that:
So that syntax can be user-friendly for those who favor explicit values in reading the array code. |
Example Current syntax: <Box w={['80px', null, null, null, 1 / 2]}></Box> Proposed alternative: <Box w={{xs: '80px', xl: 1 / 2}}></Box> This would help with two things, for one it would save everyone from having to write |
Object support is already being considered here: styled-system/styled-system#341 |
There's an interest in reviving this topic, as we've got use cases to support additional breakpoints. We also have a ton of code using the arrays; we'd prefer an approach that works as expected with existing code and extends support to an object with named properties. Using the object syntax described by @747823 might let us interpret the input differently based on type, I'm just not sure what the |
I always have to keep open a browser tab with theme.js to reference spacing and breakpoints as indices in the array. I would find it very helpful, especially for media query breakpoints, if the prop could also be passed as an object, with keys being the name of the breakpoints, like
sm
,md
, etcThe text was updated successfully, but these errors were encountered: