Layout & structure
IAspectRatio
Holds a box at a fixed ratio whatever its width. Reach for it before the content arrives: an image or an embed that sizes itself shifts everything below it when it finally loads, and a reserved box is what stops the page jumping.
16 / 9
The ratio is width divided by height, given as a number so the arithmetic reads as the ratio it is: 16 / 9, 4 / 3, 1.
Common ratios
1 / 1
4 / 3
21 / 9
Props
| Prop | Type | Default | Description |
|---|---|---|---|
ratio | number | 1 | Width divided by height |
unstyled | boolean | — | Drop the clip and radius |
The component sets the geometry, a clip and a radius. Give it a surface of its own through class:
vue
<IAspectRatio :ratio="16 / 9" class="rounded-xl border border-border">
<img src="/cover.jpg" alt="" class="size-full object-cover">
</IAspectRatio>