Aspect Ratio
shadcn/uiDisplays content within a desired ratio.
Aspect Ratio
Installation
Props
<AspectRatio />
Name | Type | |
|---|---|---|
ratio | number(default: 1) |
Search for a command to run...
Displays content within a desired ratio.

import { AspectRatio } from "@/components/optics/aspect-ratio";import Image from "next/image";<div className="w-[450px]"> <AspectRatio className="bg-muted" ratio={1.7777777777777777} > <UnknownElementType alt="Photo by Ale" className="rounded-md object-cover" fill src="/images/background-placeholder.jpeg" /> </AspectRatio></div>import { AspectRatio } from "@/components/optics/aspect-ratio";import Image from "next/image";<div className="w-[450px]"> <AspectRatio className="bg-muted" ratio={1.7777777777777777} > <UnknownElementType alt="Photo by Ale" className="rounded-md object-cover" fill src="/images/background-placeholder.jpeg" /> </AspectRatio></div>Name | Type | |
|---|---|---|
ratio | number(default: 1) |