Components
AspectRatio
Constrains its content to a fixed width-to-height ratio, sizing itself to the
available width with CSS aspect-ratio; drop a single child (image, video,
iframe, or a plain element) inside and size it to fill the framed box.
Usage
Best practices
Give it exactly one child and let it fill - set the media to
size-full object-cover;AspectRatiosizes to the available width and derives height fromratio.Use
asto change the element (a tag); userenderonly to swap in a component (e.g. a router Link). Neverrender={<Box as=…/>}- passasdirectly.
Props
Also exports
- const
aspectRatioAnatomy