Allow responsive values for `variant`, `size`, and `orientation`
See original GitHub issueThe new modifier versions of the variant
and size
props don’t accept responsive values (specified as objects or arrays). Responsive values can currently be achieved using useBreakpointValue
:
const ResponsivelySizedModal = () => {
const size = useBreakpointValue({base: 'full', lg: 'xl'})
return (
<Modal size={size}>
{/* ... */}
</Modal>
)
}
const ResponsivelySizedModal = () => {
const size = useBreakpointValue(['full', null, 'xl'])
return (
<Modal size={size}>
{/* ... */}
</Modal>
)
}
This functionality should instead become native to these props, like most other props in our system:
const ResponsivelySizedModal = () => (
<Modal size={{base: 'full', lg: 'xl'}}>
{/* ... */}
</Modal>
)
const ResponsivelySizedModal = () => (
<Modal size={['full', null, 'xl']}>
{/* ... */}
</Modal>
)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:42
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Using media queries - CSS: Cascading Style Sheets | MDN
Combining multiple types or features · (min-width: 30em) and (orientation: landscape) ; Testing for multiple queries · (min-height: 680px), screen ...
Read more >Responsive Styles - Chakra UI
To make styles responsive, you can use either the array or object syntax. The Array syntax#. All style props accept arrays as values...
Read more >Build adaptive layouts | Jetpack Compose - Android Developers
If you want to change where or how content is displayed, you can use a collection of modifiers or a custom layout to...
Read more >Building responsive components in Chakra UI - LogRocket Blog
When it comes to writing responsive CSS, developers have the option of choosing between mobile-first and desktop-first approaches. Chakra UI ...
Read more >Responsive And Fluid Typography With vh And vw Units
A heading size of 2em is now equivalent to 4vw because this is twice the current font size of 2vw . Using viewport-relative...
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 for this, Mark.
We can consider this post v1.
We should also support
orientation
as part of this effort. See #2686