4.2.0
Core

AspectRatio

Locks a child to a width-to-height ratio, and supplies no ground, ink or border of its own.

Aspect ratio

A layout constraint, not a surface — it carries no ground, ink or border of its own. The bordered media plate below is composed inside it.

16 / 9
1 / 1

Usage

import { AspectRatio } from '@oceanic-hub/brand-system'

This is a layout constraint, not a surface — it has no role to reach for, because it paints nothing. A caller who wants a bordered media plate composes one inside it, the way the demo does; AspectRatio itself stays invisible.

ratio is a plain number — width over height, so 16 / 9, not the string "16/9". Omit it and it defaults to 1, a square. asChild replaces the inner fill element, not the wrapper: Radix always inserts its own padding-bottom div to make the ratio, and asChild only decides what fills it — for the case where the ratio belongs on an element that already exists for another reason.

Both of upstream's other ratios — square and portrait — are this same mechanism with a different number, which is why the demo already shows two side by side rather than one ratio repeated per section.

Trivial generation: this is a thin re-export of Radix's own primitive, unchanged since before the Base UI rebase, so there is nothing upstream carries that this package does not.

RTL is not supported, and upstream ships an RTL example. Nothing in this package has been laid out or measured right-to-left, so the refusal is written down in pairings.json under direction rather than left to be discovered — though a ratio box has no direction-dependent geometry of its own, so the refusal is inherited rather than distinct to this component.

API Reference

See the AspectRatio API page for every prop of every part, with types, defaults and the contract that pins them.

On this page