Skip to Content
ComponentsLayoutAspectRatio

AspectRatio

Keeps content at a fixed ratio (width / height). Useful for video embeds, image placeholders and map containers.

16 : 9

import { AspectRatio } from '@gg-software/ui'; <AspectRatio ratio={16 / 9}> <iframe src="https://www.youtube.com/embed/…" /> </AspectRatio> <AspectRatio ratio={1}> <img src="/avatar.jpg" alt="" /> </AspectRatio>

Props

PropTypeDefaultDescription
rationumber16 / 9width / height, e.g. 16 / 9
childrenReactNodecontent rendered inside the component
classNamestring
styleCSSProperties

* required · generated from packages/ui/src/layout/AspectRatio/AspectRatio.tsx