Skip to content
nexubDesign System
v11.9.0

Components · Layout

Aspect Ratio

StableAdded v0.0.1

Keeps its content at a fixed width-to-height ratio, for images, video and embeds.

import { AspectRatio } from '@nexub/react';
View as Markdown

Examples

Image

16 : 9

Ratios

1 : 1
4 : 3
3 : 4

Props

Props
PropTypeDefaultDescription
rationumber16 / 9Width divided by height, e.g. 16 / 9 or 1. Common ratios (1, 16/9, 4/3, 3/2, 21/9, 9/16, 3/4, 2/3) use a class and are strict-CSP safe; any other ratio sets an inline aspect-ratio style.
childrenReactNode—Fills the box; give an image h-full w-full object-cover.

On iOS & Android