Aspect Ratio
A frame that keeps content at a fixed ratio of width to height.
An aspect ratio holds its content in a frame with a fixed ratio of width to height. The frame takes its width from its parent and derives its height from the ratio, so an image or a video keeps its shape at every screen size.
Usage
Examples
Square
Assortment overviews and search results place many items side by side, and their pictures rarely share one shape. With ratio set to 1 / 1, every frame is as tall as it is wide, so the items line up evenly and users compare them at a glance.
Portrait
Some content is made for upright formats, such as signage for displays mounted in portrait orientation. A ratio below 1, as in 9 / 16, makes the frame taller than wide, so users see that content in the shape it was made for. Since the height follows the width, the element around the frame sets a width that keeps it within view.
API Reference
| Prop | ratio |
|---|---|
| Type | number |
| Default | – |
| Description | Sets the width of the frame divided by its height, as in 16 / 9. The component requires this prop. |