Aspect Ratio
Fixed-ratio media frame recipes for images, video, and embeds.
16/9 frame
Usage
import { aspectRatio, aspectRatioContent } from "coatx/aspect-ratio";
export const VideoFrame = () => (
<div {...aspectRatio({ ratio: "16/9" })}>
<img src="/cover.jpg" alt="Preview" {...aspectRatioContent()} />
</div>
);
Exports (coatx/aspect-ratio)
| Export | Description |
|---|---|
aspectRatio(options?) |
Fixed-ratio container (ratio: "16/9", "4/3", "1/1", "21/9", "3/2", "9/16") |
aspectRatioContent(options?) |
Inset stretched media slot for <img>, <video>, or <iframe> |
aspectRatioStyles |
Compiled StyleX style map |