Aspect Ratio
scrollxui/aspect-ratioFreeComponent
A responsive container component that maintains a fixed aspect ratio, commonly used for media like images and videos.
Live preview
live · rendered by the registry
Rendered by scrollxui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://scrollxui.dev/registry/aspect-ratio.jsonSource
1"use client";23import * as React from "react";4import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";5import type { AspectRatioProps } from "@radix-ui/react-aspect-ratio";67const AspectRatio = React.forwardRef<HTMLDivElement, AspectRatioProps>(8 ({ ratio = 16 / 9, className, ...props }, ref) => (9 <AspectRatioPrimitive.Root10 ref={ref}11 ratio={ratio}12 className={className}13 {...props}14 />15 )16);1718AspectRatio.displayName = "AspectRatio";1920export { AspectRatio };
What it pulls in
npm packages
Files it writes
More from scrollxui
All 180 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | scrollxui | Components | Free | 4 deps | |
| Alert Dialogalert-dialog | scrollxui | Components | Free | 7 deps | |
| Animated Buttonanimated-button | scrollxui | Components | Free | 4 deps | |
| Animated Tabsanimated-tabs | scrollxui | Components | Free | 1 dep | |
| Animated Testimonialsanimated-testimonials | scrollxui | Components | Free | 2 deps | |
| Animated TextGenerateanimated-textgenerate | scrollxui | Components | Free | 3 deps | |
| Announcementannouncement | scrollxui | Components | Free | 5 deps | |
| Aurora Dotsaurora-dots | scrollxui | Components | Free | 2 deps |
