Layout
AspectRatio
Locks a child block to a fixed width:height ratio. Wraps the CSS aspect-ratio property.
Examples
16 / 9
16 / 9
<AspectRatio ratio={16/9}>…</AspectRatio>1:1
1 / 1
<AspectRatio ratio={1}>…</AspectRatio>Props
| Prop | Type | Default | Description |
|---|---|---|---|
ratio | number | 16 / 9 | width:height ratio. Common picks: 16/9, 4/3, 1, 3/2. |
...rest | HTMLAttributes<HTMLDivElement> | — | Spread onto the underlying <div>. |
Install
CLI
npx @a3tai/mittsu add aspect-ratio