shadcn.io is an independent project built on shadcn/ui
A muted box shows 16:9 in the center. The frame stays widescreen as the width changes, and the height follows the ratio.
Use 16:9 for video and hero images. A Card can hold the same frame with a caption. Ark UI in Vue does not load the video.
Installation
Anatomy

Usage
<div class="w-full max-w-md">
<AspectRatio :ratio="16 / 9">
<div class="flex size-full items-center justify-center rounded-md bg-muted">
<span class="text-muted-foreground text-sm">16:9</span>
</div>
</AspectRatio>
</div>FAQ
How is 16:9 set on this frame?
ratio is 16 / 9 on AspectRatio, width divided by height. That is a widescreen frame. The centered label reads "16:9".
Where does the frame's width come from?
The parent is w-full max-w-md. The height follows that width. Give the wrapper a width, because a ratio with no width can collapse. max-w-md caps the frame near 28rem wide.
How does the label fill the frame?
The child is a div with size-full, flex items-center justify-center, rounded-md, and bg-muted. The span is text-sm text-muted-foreground. Those classes are on the child, so the frame's shape stays on ratio.
How does ratio become a height?
The ratio is stored in the --ratio custom property, and the aspect-ratio utility reads that variable.
How do I put an image or a video in this frame?
Put one child in AspectRatio and make it fill the box. The Aspect Ratio usage places the image absolutely, inset on every side, at full size, with object-cover. This file's child is the muted "16:9" label.
API Reference
Aspect Ratio
Sets ratio="16 / 9". The rest is on the Aspect Ratio page.





