Second array value skipped with responsive styling + custom breakpoints
See original GitHub issue🐛 Bug report
When using custom breakpoints, adding responsive styling with array syntax skips the second value.
💥 Steps to reproduce
- Add custom breakpoints to theme.ts.
- Go to any component and use array syntax for responsive styling. Eg.
bg={["tomato", "green", "blue", "yellow"]}
. - You will notice the second value of the array
"green"
is never applied.
💻 Link to reproduction
CodeSandbox reproduction: https://codesandbox.io/s/kind-thunder-khlbw?file=/src/index.js
🧐 Expected behavior
All array values should be incrementally applied.
bg={["tomato", "green", "blue", "yellow"]}
tomato - base green - sm blue - md yellow -lg
🌍 System information
Software | Version(s) |
---|---|
Chakra UI | 1.6.3 |
Browser | Chrome |
Operating System | Ubuntu 16.04 |
📝 Additional information
Link to discussions #4178
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Skipping values while using responsive style props #4178
It is strange that the second array value is skipped with custom breakpoints.
Read more >4 Patterns for Responsive Props in React - DEV Community
Responsive Prop Patterns. The foundation of responsive props in react is knowing whether a given media query (aka breakpoint) is active. Let's ...
Read more >Breakpoints - Material UI - MUI
API that enables the use of breakpoints in a wide variety of contexts.
Read more >Responsive Styles - Chakra UI
All style props accept arrays as values for mobile-first responsive styles. ... To skip certain breakpoints, you can pass null to any position...
Read more >Building Responsive Apps with Base Web
Tips and tricks for building responsive apps for mobile and desktop using Base Web.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @jatin33 for taking the time to find a workaround this! It had me bumfuzzled since forever!
🦕
@spidertwin2 Have you tried using “em” or “rem” instead of “px” as css unit to create custom breakpoints? I tried and it seems to be working. working sandbox url: https://codesandbox.io/s/exciting-jepsen-gvlou?file=/src/theme.ts @with-heart Is this expected or we can treat it as a bug? or we can add something to mention about this in documentation Loom Video: https://www.loom.com/share/e83c44c9633647f8a1e32a0044242568