Aspect Ratio
draco-china-github/aspect-ratio-exampleFreeExample
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/draco-china/shadcn-pro/main/apps/docs/public/r/styles/radix-sera/aspect-ratio-example.jsonSource
1import Image from "next/image"23import {4 Example,5 ExampleWrapper,6} from "@/registry/radix-sera/components/example"7import { AspectRatio } from "@/registry/radix-sera/ui/aspect-ratio"89export default function AspectRatioExample() {10 return (11 <ExampleWrapper className="max-w-4xl 2xl:max-w-4xl">12 <AspectRatio16x9 />13 <AspectRatio21x9 />14 <AspectRatio1x1 />15 <AspectRatio9x16 />16 </ExampleWrapper>17 )18}1920function AspectRatio16x9() {21 return (22 <Example title="16:9" className="items-center justify-center">23 <AspectRatio24 ratio={16 / 9}25 className="rounded-lg bg-muted style-lyra:rounded-none style-luma:rounded-3xl style-sera:rounded-none"26 >27 <Image28 src="https://avatar.vercel.sh/shadcn1"29 alt="Photo"30 fill31 className="h-full w-full rounded-lg object-cover grayscale dark:brightness-20 style-lyra:rounded-none style-luma:rounded-3xl style-sera:rounded-none"32 />33 </AspectRatio>34 </Example>35 )36}3738function AspectRatio1x1() {39 return (40 <Example title="1:1" className="items-start">41 <AspectRatio42 ratio={1 / 1}43 className="rounded-lg bg-muted style-lyra:rounded-none style-luma:rounded-3xl style-sera:rounded-none"44 >45 <Image46 src="https://avatar.vercel.sh/shadcn1"47 alt="Photo"48 fill49 className="h-full w-full rounded-lg object-cover grayscale dark:brightness-20 style-lyra:rounded-none style-luma:rounded-3xl style-sera:rounded-none"50 />51 </AspectRatio>52 </Example>53 )54}5556function AspectRatio9x16() {57 return (58 <Example title="9:16" className="items-center justify-center">59 <AspectRatio60 ratio={9 / 16}61 className="rounded-lg bg-muted style-lyra:rounded-none style-luma:rounded-3xl style-sera:rounded-none"62 >63 <Image64 src="https://avatar.vercel.sh/shadcn1"65 alt="Photo"66 fill67 className="h-full w-full rounded-lg object-cover grayscale dark:brightness-20 style-lyra:rounded-none style-luma:rounded-3xl style-sera:rounded-none"68 />69 </AspectRatio>70 </Example>71 )72}7374function AspectRatio21x9() {75 return (76 <Example title="21:9" className="items-center justify-center">77 <AspectRatio78 ratio={21 / 9}79 className="rounded-lg bg-muted style-lyra:rounded-none style-luma:rounded-3xl style-sera:rounded-none"80 >81 <Image82 src="https://avatar.vercel.sh/shadcn1"83// … truncated
What it pulls in
Other registry items
Files it writes
More from shadcn/ui
All 201 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion-example | shadcn/ui | Examples | Free | no deps | |
| Alert Dialogalert-dialog-example | shadcn/ui | Examples | Free | no deps | |
| Alertalert-example | shadcn/ui | Examples | Free | no deps | |
| Avataravatar-example | shadcn/ui | Examples | Free | no deps | |
| Badgebadge-example | shadcn/ui | Examples | Free | no deps | |
| Breadcrumbbreadcrumb-example | shadcn/ui | Examples | Free | no deps | |
| Buttonbutton-example | shadcn/ui | Examples | Free | no deps | |
| Button Groupbutton-group-example | shadcn/ui | Examples | Free | no deps |
