Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bar List
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Checkbox Group
- Circular Progress
- Collapsible
- Combobox
- Command
- Context Menu
- Currency Input
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Meter
- Multi Combobox
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Phone Input
- Popover
- Progress
- Progress List
- Prompt
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stat
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Typography
Loading...
import Image from "next/image";
import { AspectRatio } from "@/components/ui/aspect-ratio";
export function AspectRatioDemo() {
return (
<AspectRatio className="w-full max-w-sm rounded-lg bg-muted" ratio={16 / 9}>
<Image
alt="Photo"
className="rounded-lg object-cover grayscale dark:brightness-20"
fill
src="https://avatar.vercel.sh/shadcn1"
/>
</AspectRatio>
);
}Installation
npx shadcn@latest add "https://ui.blode.co/r/styles/default/aspect-ratio"
Usage
import Image from "next/image";
import { AspectRatio } from "@/components/ui/aspect-ratio";<div className="w-[450px]">
<AspectRatio ratio={16 / 9}>
<Image src="..." alt="Image" className="rounded-md object-cover" />
</AspectRatio>
</div>