{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"aspect-ratio","type":"registry:ui","title":"Aspect ratio","description":"A box that keeps a fixed ratio so images and video never shift the layout.","dependencies":["clsx","tailwind-merge"],"registryDependencies":["https://caliperui.site/r/styles.json"],"files":[{"path":"ui/aspect-ratio.tsx","type":"registry:ui","target":"components/ui/aspect-ratio.tsx","content":"import type { ComponentProps, ReactNode } from \"react\";\nimport { cn } from \"./lib/cn\";\nimport \"./aspect-ratio.css\";\n\nexport function AspectRatio({\n  ratio = 1,\n  animated = true,\n  children,\n  className,\n  ...props\n}: Omit<ComponentProps<\"div\">, \"children\"> & {\n  ratio?: number;\n  animated?: boolean;\n  children?: ReactNode;\n}) {\n  const safe = Number.isFinite(ratio) && ratio > 0 ? ratio : 1;\n  return (\n    <div\n      data-slot=\"aspect-ratio\"\n      data-animated={animated}\n      className={cn(\"relative w-full overflow-hidden\", className)}\n      style={{ aspectRatio: String(safe) }}\n      {...props}\n    >\n      {children}\n    </div>\n  );\n}\n\nexport function AspectRatioImage({\n  alt,\n  className,\n  ...props\n}: ComponentProps<\"img\"> & { alt: string }) {\n  return (\n    <img\n      alt={alt}\n      data-slot=\"aspect-ratio-image\"\n      className={cn(\"absolute inset-0 size-full object-cover\", className)}\n      {...props}\n    />\n  );\n}\n"},{"path":"ui/lib/cn.ts","type":"registry:ui","target":"components/ui/lib/cn.ts","content":"import { clsx, type ClassValue } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n  extend: { theme: { radius: [\"control\", \"surface\", \"overlay\"], shadow: [\"overlay\"] } },\n});\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n"},{"path":"ui/aspect-ratio.css","type":"registry:file","target":"components/ui/aspect-ratio.css","content":"/* aspect-ratio.tsx's styles; it imports this file. Edit freely. */\n@layer theme, base, components, utilities;\n\n@layer components {\n  [data-slot=\"aspect-ratio\"][data-animated=\"true\"] {\n    transition: aspect-ratio var(--duration-normal) var(--ease-settle);\n  }\n\n  @media (prefers-reduced-motion: reduce) {\n    [data-slot=\"aspect-ratio\"][data-animated=\"true\"] {\n      transition: aspect-ratio 180ms var(--ease-settle);\n    }\n  }\n}\n"}],"categories":["navigation"],"meta":{"tier":"free","license":"MIT","family":"identity-navigation","docs":"/docs/components/aspect-ratio"}}