shadimage
extend
uiaspect-ratiosource: ok · hit

Aspect Ratio

A small wrapper for preserving media aspect ratios.

npx shadcn add "https://ui.extend.ai/r/aspect-ratio.json"
free

No selection tags yet — empty means no evidence, not lack of support.

Files1 · source cached 10/11/2026, 11:42:38 PM

registry/new-york-v4/ui/aspect-ratio.tsx
"use client"

import type React from "react"

function AspectRatio({
  ratio = 1,
  style,
  ...props
}: React.ComponentProps<"div"> & {
  ratio?: number
}): React.ReactElement {
  return (
    <div
      data-slot="aspect-ratio"
      style={{ aspectRatio: ratio, ...style }}
      {...props}
    />
  )
}

export { AspectRatio }

More from extend

Browse all components in this library →