Skip to Content
Liquid Glass UI
Components

AspectRatio

Unstyled layout utility for displaying images, videos, or cards at a fixed aspect ratio using native CSS aspect-ratio.

Fully compatible with the standard shadcn/ui JSX API. AspectRatio is a pure layout utility powered by native CSS aspect-ratio, carrying no surface material or border radius so it nests seamlessly inside glass Cards, Carousels, and other containers. Add Apple-style corner radii directly via className, such as rounded-[18px] on mobile ↔ md:rounded-[12px] on desktop.

apple-liquid-ui/preview/aspect-ratio-demo
MacBook · 16:10

Installation (Shadcn Registry)

npx shadcn@latest add @apple-liquid/aspect-ratio

Usage

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

export function Example() {
  return (
    <AspectRatio ratio={16 / 9} className="overflow-hidden rounded-[18px] md:rounded-[12px]">
      <img src="/cover.jpg" alt="Cover" className="size-full object-cover" />
    </AspectRatio>
  );
}

Props API

PropTypeDefaultDescription
rationumber—Desired width-to-height ratio, e.g. 16 / 9 or 1 (required)

On this page