Aspect Ratio

Preview

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/aspect-ratio

API Reference

AspectRatio

ratio?
number

Width divided by height, for example 16 / 9. Must be finite and positive.

Default1
animated?
boolean

Morph layout changes. Reduced motion always skips movement.

Defaulttrue
contentClassName?
string

Classes for the content layer, such as alignment or padding.

Default—
className?
string
Default—

AspectRatioImage

alt
string
Default—
width
number

Intrinsic width in pixels, used to reserve the image's cover crop.

Default—
height
number

Intrinsic height in pixels. Keep these dimensions accurate for the source.

Default—
className?
string
Default—

Updated