Aspect Ratio
Maintain consistent dimensions for media content
Use the AspectRatio
component to maintain consistent dimensions for media content across different screen sizes by locking in a specific width-to-height ratio. They provide visual consistency in responsive design, and ensures that media scales correctly on various devices.
21:9
16:9
4:3
To use the AspectRatio
component, wrap your element into the component and specify your aspect ratio in the ratio
prop. You can use the following syntax to set the aspect ratio:
API
Prop | Purpose |
---|---|
ratio | Specifies the aspect ratio. |
className | Pass additional CSS classes for the component. |
Request improvement for this page