Skip to content

Aspect Ratio

Displays content within a desired ratio.

Landscape by Drew Beamer

Install

Bash
npx @madeui/cli add aspect-ratio

Usage

TSX
import { AspectRatio } from '@/components/ui/aspect-ratio';

Square

Portrait

API reference

A plain <div> using the CSS aspect-ratio property.

PropTypeDefaultDescription
rationumber—Width / height, e.g. 16 / 9.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

Was this page helpful?