Card
blode-ui/cardFreeComponent
A container for grouping related content and actions.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/mblode/blode-ui/main/public/r/card.jsonSource
1import type * as React from "react";23import { cn } from "@/lib/utils";45const Card = ({6 className,7 size = "default",8 ...props9}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) => (10 <div11 className={cn(12 "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-card-foreground text-sm ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 has-data-[slot=card-footer]:pb-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",13 className,14 )}15 data-size={size}16 data-slot="card"17 {...props}18 />19);2021const CardHeader = ({ className, ...props }: React.ComponentProps<"div">) => (22 <div23 className={cn(24 "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",25 className,26 )}27 data-slot="card-header"28 {...props}29 />30);3132const CardTitle = ({ className, ...props }: React.ComponentProps<"div">) => (33 <div34 className={cn(35 "font-medium text-base leading-snug group-data-[size=sm]/card:text-sm",36 className,37 )}38 data-slot="card-title"39 {...props}40 />41);4243const CardDescription = ({ className, ...props }: React.ComponentProps<"div">) => (44 <div45 className={cn("text-muted-foreground text-sm", className)}46 data-slot="card-description"47 {...props}48 />49);5051const CardAction = ({ className, ...props }: React.ComponentProps<"div">) => (52 <div53 className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}54 data-slot="card-action"55 {...props}56 />57);5859const CardContent = ({ className, ...props }: React.ComponentProps<"div">) => (60 <div61 className={cn("px-4 group-data-[size=sm]/card:px-3", className)}62 data-slot="card-content"63 {...props}64 />65);6667const CardFooter = ({ className, ...props }: React.ComponentProps<"div">) => (68 <div69 className={cn(70 "flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",71 className,72 )}73 data-slot="card-footer"74 {...props}75 />76);7778export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent };
Files it writes
More from blode/ui
All 85 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | blode/ui | Components | Free | 2 deps | |
| Alertalert | blode/ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | blode/ui | Components | Free | 1 dep | |
| Ask User Questionsask-user-questions | blode/ui | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | blode/ui | Components | Free | 1 dep | |
| Attachmentattachment | blode/ui | Components | Free | 1 dep | |
| Autocompleteautocomplete | blode/ui | Components | Free | 1 dep | |
| Avataravatar | blode/ui | Components | Free | 1 dep |
