aspect-ratio not supported
See original GitHub issueDescription
Passing aspectRatio
into layout components isn’t recognized, it only works when passing it into the sx
prop.
Link to Reproduction
https://codesandbox.io/s/happy-brattain-s7uku?file=/src/App.js
Steps to reproduce
- The red box has
aspectRatio={'1'}
passed directly into it, but it does not show up asaspect-ratio: 1;
in the rendered page. - The blue box has
aspectRatio={'1'}
passed through thesx
prop and it renders as expected.
Chakra UI Version
1.6.5
Browser
Brave Version 1.27.108
Operating System
- macOS
- Windows
- Linux
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
CSS Maintain Aspect Ratio not working - Stack Overflow
CSS has a property for this .square { aspect-ratio: 1 / 1; width: 100px; background: grey; padding: 10px; color: white; }
Read more >Post Error: ASPECT_RATIO_NOT_ALLOWED - WordStream HQ
If you've encountered an error message stating ASPECT_RATIO_NOT_ALLOWED, this error occurs when at least one of your logo images does not successfully crop ......
Read more >CSS property: aspect-ratio | Can I use... Support ... - CanIUse
The aspect-ratio CSS property sets a preferred aspect ratio for the box, which will be used in the calculation of auto sizes and...
Read more >aspect-ratio - CSS-Tricks
The CSS property aspect-ratio lets you create boxes that maintain proportional dimensions where the height and width of a box are calculated ...
Read more >Aspect ratios supported by placements in Meta Ads Manager
1.91:1 16:9 1:1 4:5
Facebook Feed ✓ ✓ ✓. Recommended for images ✓. Recommended f...
Instagram Feed and Explore ✓ ✓ ✓. Recommended for images...
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 bringing this up @ngregrichardson!
We support the most common CSS properties as component props. A CSS property which refers to a token in the theme makes sense to provide them as a component prop, but the
aspect-ratio
is a rarely used (imo) one and can be achieved with our<AspectRatio />
component.Let’s see if this issue gets a few upvotes or the stale does it’s job and closes this feature request.
I’d love to see
aspect-ratio
supported, as it has good browser support and achieves what theAspectRatio
component does in one line, plus works flawlessly with flex layouts.Please let me know if a PR would be accepted.