Skip to content

AspectRatio

Preserve the proportions of images, videos, and illustrations.

alpina-ui/ui/aspect-ratio

Interactive preview

3 ∶ 2

Usage notes

Use fit="contain" for a screenshot or diagram whose edges must remain visible. The default cover fit fills the frame by cropping when needed.

When to use

Reserve the final shape of a photo, film or diagram as its container changes width.

When to avoid

A fixed aspect ratio clips variable-length copy and forms. Let text determine their height.

Accessibility

Give the contained image an appropriate alternative and preserve the edges of maps or diagrams used for instructions.

Keys
KeyAction
—Read in document order. The component has no keyboard command of its own.

Content

Describe the useful subject in a brief alternative. Leave the decorative frame unlabelled and put extended context in a caption.

Use
Entrance on the south side of the station
Avoid
Image 03, landscape

Copy in four languages

German
Südeingang10 characters
French
Entrée sud10 characters
Italian
Ingresso sud12 characters
Romansh
Entrada sid11 characters
Add to your project
npx --no-install alpina add aspect-ratio