Layoutsrc/components/ui/aspect-ratio.tsx

Aspect Ratio

Keeps media and custom content within a consistent ratio.

Preview

Aspect Ratio Demo
Aspect Ratio Demo 2

Installation

Copy the component source into your project with `degit`. This port is intentionally not distributed as an npm package.

bunx degit https://github.com/LiasCode/shadcn-preact/src/components/ui#main ./src/components/ui

Usage

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

export function Example() {
  return <AspectRatio>Aspect Ratio</AspectRatio>
}

API Reference

ExportPurpose
AspectRatioComposable part exported by `@/components/ui/aspect-ratio`.