Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Aspect Ratio

Displays content within a desired ratio.

16 / 9

Installation

npx logic2b@latest add aspect-ratio

Usage

import { AspectRatio } from "@/components/ui/aspect-ratio"

<AspectRatio ratio={16 / 9}>
  <img src="..." alt="Image" className="rounded-md object-cover" />
</AspectRatio>

API

Prop Type Default
ratio number — desired width-to-height ratio (e.g. 16 / 9) 1

Also accepts any standard div props, which are forwarded to the wrapper.

Examples

Square

1 / 1

Portrait

3 / 4