Skip to main content
Copy for LLM

Aspect Ratio

A container that maintains a fixed aspect ratio. Useful for images, videos, maps, and embeds.

Basic Usage

Image constrained to 16:9
Landscape photo

Common Ratios

Different ratios with the same image
16:9 landscape

16:9 (default)

4:3 landscape

4:3

1:1 square

1:1 (square)

Portrait and Ultrawide

Portrait and ultrawide ratios
3:4 portrait

3:4 (portrait)

21:9 ultrawide

21:9 (ultrawide)

Props

Prop Type Default Description
ratio string|number '16/9' Aspect ratio value, e.g. "16/9", "4/3", "1/1", or 1.5
scope string|null null Scoped personalization name

The component renders as a <div> with overflow-hidden and position: relative. The native CSS aspect-ratio property handles the sizing. Children (images, videos, embeds) should use object-fit: cover and width: 100%; height: 100% to fill the container.

In a row or a grid of columns, give each column that holds a box min-width: 0, as the previews above do. A flex or grid item does not shrink below the width of its content, and Safari and every other browser on iOS keep measuring that content at the width the column had before the window narrowed. A phone turned upright then leaves the columns wider than the screen. A grid already gives the columns it builds from cols a minimum of zero.

Zero suits a column that holds only a box. A column with a caption under its box cannot shrink past the caption's longest word, so give it a floor that carries the caption, as the ultrawide column in the second preview does with min-width: 8rem. A floor set as a length does not depend on the image, so the narrowing problem above does not reach it.

Keyboard Interaction

This component is a layout wrapper. Keyboard interaction is delegated to its children.

Updated in WireKit v2.66.0 (2026-10-13)

Was this page helpful?

Thank you for your feedback!

Voting requires cookies or local storage. What we store