Aspect Ratio
uiable/aspect-ratioFreeComponent
Aspect Ratio component.
Live preview
live · rendered by the registry
Rendered by uiable on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://uiable.com/r/aspect-ratio.jsonSource
1import { ComponentProps, CSSProperties } from "react"23import { cn } from "@/lib/utils"45function AspectRatio({6 ratio,7 className,8 ...props9}: ComponentProps<"div"> & { ratio: number }) {10 return (11 <div12 data-slot="aspect-ratio"13 style={14 {15 "--ratio": ratio,16 } as CSSProperties17 }18 className={cn("relative aspect-(--ratio)", className)}19 {...props}20 />21 )22}2324export { AspectRatio }
Files it writes
More from uiable
All 712 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | uiable | Components | Free | 2 deps | |
| Alertalert | uiable | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | uiable | Components | Free | 1 dep | |
| Attachmentattachment | uiable | Components | Free | 2 deps | |
| Avataravatar | uiable | Components | Free | 1 dep | |
| Badgebadge | uiable | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | uiable | Components | Free | 2 deps | |
| Bubblebubble | uiable | Components | Free | 2 deps |
