Skip to content
Display

Aspect Ratio

Server Component

Constrain content to a fixed width-to-height ratio.

Import

tsx
import { AspectRatio } from "@cronus-ui/ui";
bash
npx cronus-ui add aspect-ratio

Examples

.cronus

The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.

PortedParity: MatchGeometry 1/1Pixel diff 0 pxLogic 1/1Parity scoreboard
default.cronus
app "audit-fixtures" {
  port 5176
}

style {
  preset aurora
  theme dark
}

component AspectRatioDefault layout:inline style:aspect-ratio {
  label "Framed"
}

page "/audit/aspect-ratio/default" type:custom {
  use AspectRatioDefault
}

API Reference

Generated from the component's exported types.

AspectRatioProps

Extends HTMLAttributes<HTMLDivElement>

Skip AspectRatioProps props table
PropTypeDefaultDescription
ratio
number16 / 9The desired width-to-height ratio, expressed as a number (e.g. `16 / 9`, `1`, `4 / 3`). Defaults to `16 / 9`.
className
string—Additional class names merged onto the root.
children
ReactNode—Contents of the component.
id
string—DOM id of the root element.