AspectRatio

Layout

Keeps its content at a width-to-height ratio (16 / 9, 1, 4 / 3) as its width changes, so images and embeds don't shift the page while they load.

import { AspectRatio } from '@limerdev/zest';
AspectRatio for AI tools (llms.txt)
Use for
Images, video and map embeds in a fluid layout.
Don't
Plain media with known width and height attributes: the browser keeps their ratio already.

Examples

Basic

The box keeps 16:9 as the page narrows.

16 : 9

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

AspectRatio

Prop Type Default Description
ratio number 1 The aspect ratio of the image.