question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow responsive values for `variant`, `size`, and `orientation`

See original GitHub issue

The 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:closed
  • Created 3 years ago
  • Reactions:42
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
segunadebayocommented, Jun 29, 2020

Thanks for this, Mark.

We can consider this post v1.

2reactions
with-heartcommented, Dec 1, 2020

We should also support orientation as part of this effort. See #2686

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found