Capítulo 11 de 43
A single-purpose primitive that constrains its content to a given width:height ratio, regardless of the content's natural size.
ratio prop: a number (width divided by height, e.g. 16 / 9), defaulting to 1 (square).AspectRatio.Root — no sub-parts, unlike most other primitives.import { AspectRatio } from "radix-ui";
<AspectRatio.Root ratio={16 / 9}>
<img src="..." style={{ objectFit: "cover", width: "100%", height: "100%" }} />
</AspectRatio.Root>
object-fit: cover (or contain) on the child media element to control how it fills the ratio box.