datui
Color scheme

Layout

AspectRatio

Box locked to an aspect ratio; children stretch to fill.

import { AspectRatio } from "datui";

Examples

Ratios

16 / 9
Square, children not stretched

Accessibility

  • Layout only; semantics come from the children.

API

AspectRatio

Box locked to an aspect ratio at fluid width.

PropTypeDefaultDescription
ratio (required)string | number—Width / height, as a number (`16 / 9`) or any CSS `aspect-ratio` value (`"4 / 3"`, `var(--x)`).
asElementType<any, keyof IntrinsicElements>div
classNamestring—
mode"none" | "stretch"stretch`stretch` makes every child fill the box.