Components
Aspect Ratio
Aspect ratio box: CSS aspect-ratio, unstyled, no hover effect.
Preview
16:9
Install
bash
npx shadcn add @eloquent/aspect-ratioUsage
tsx
import { AspectRatio } from "@/components/ui/aspect-ratio";
<AspectRatio ratio={16 / 9}>
<img src="/lead.jpg" alt="The chamber, seen from the gallery" className="size-full object-cover" />
</AspectRatio>ratio is width divided by height and defaults to 1. The box is as wide as its container; set a width with className.
States
- 1:11:1
- 4:34:3
- 16:916:9
- 3:43:4
The component is not interactive: it has no hover, focus or disabled state and no motion.
Keyboard
It takes no focus. Anything focusable inside it follows its own keyboard story.
Vietnamese
16:9
Ink adaptation
None. Upstream ships it unstyled, and so does this item: no rule, fill, radius or shadow. The examples give the panel a tint-1 fill and the caption a hairline rule. Built on the CSS aspect-ratio property, with no Base UI part.