◇
AspectRatio
1 partsDisplays content within a fixed, responsive width-to-height ratio. The
element grows to fill its container's width and derives its height from the
ratio, so the box keeps its proportions at any size. Use it to reserve
layout space for images, video, maps, or embeds and avoid content shift.
Demo
Loading demo…
Anatomy
Import the parts and compose them. Each part forwards attributes to its underlying element.
vue
import {
AspectRatio,
} from '@robonen/primitives/display/aspect-ratio';
<AspectRatio />API Reference
AspectRatio
RootDisplays content within a fixed, responsive width-to-height ratio. The element grows to fill its container's width and derives its height from the `ratio`, so the box keeps its proportions at any size. Use it to reserve layout space for images, video, maps, or embeds and avoid content shift.
| Prop | Type | Description |
|---|---|---|
ratio? | number | Desired width-to-height ratio (e.g. 16 / 9, 1, 4 / 3). |