shadimage
retab
uiaspect-ratiosource: ok · hit

Aspect Ratio

A small wrapper for preserving media aspect ratios.

npx shadcn add "https://ui.retab.com/r/aspect-ratio.json"
free

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

Files1 · source cached 10/11/2026, 3:54:44 AM

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 retab

Browse all components in this library →