card
formscn/cardFreeComponent
Card component
Install it
npx shadcn@latest add https://formscn.space/r/card.jsonSource
1import * as React from "react";23import { cn } from "@/lib/utils";45function Card({6 className,7 size = "default",8 ...props9}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {10 return (11 <div12 data-slot="card"13 data-size={size}14 className={cn(15 "ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl border py-4 text-xs/relaxed ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-2 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 group/card flex flex-col",16 className,17 )}18 {...props}19 />20 );21}2223function CardHeader({ className, ...props }: React.ComponentProps<"div">) {24 return (25 <div26 data-slot="card-header"27 className={cn(28 "gap-1 rounded-none px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",29 className,30 )}31 {...props}32 />33 );34}3536function CardTitle({ className, ...props }: React.ComponentProps<"div">) {37 return (38 <div39 data-slot="card-title"40 className={cn("text-sm font-medium group-data-[size=sm]/card:text-sm", className)}41 {...props}42 />43 );44}4546function CardDescription({ className, ...props }: React.ComponentProps<"div">) {47 return (48 <div49 data-slot="card-description"50 className={cn("text-muted-foreground text-xs/relaxed", className)}51 {...props}52 />53 );54}5556function CardAction({ className, ...props }: React.ComponentProps<"div">) {57 return (58 <div59 data-slot="card-action"60 className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)}61 {...props}62 />63 );64}6566function CardContent({ className, ...props }: React.ComponentProps<"div">) {67 return (68 <div69 data-slot="card-content"70 className={cn("px-4 group-data-[size=sm]/card:px-3", className)}71 {...props}72 />73 );74}7576function CardFooter({ className, ...props }: React.ComponentProps<"div">) {77 return (78 <div79 data-slot="card-footer"80 className={cn(81 "rounded-none border-t p-4 group-data-[size=sm]/card:p-3 flex items-center",82 className,83 )}84 {...props}85 />86 );87}8889// … truncated
Files it writes
More from formscn
All 30 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| buttonbutton | formscn | Components | Free | 2 deps | |
| calendarcalendar | formscn | Components | Free | 2 deps | |
| checkboxcheckbox | formscn | Components | Free | 1 dep | |
| fieldfield | formscn | Components | Free | no deps | |
| inputinput | formscn | Components | Free | 1 dep | |
| labellabel | formscn | Components | Free | 2 deps | |
| phone-inputphone-input | formscn | Components | Free | 2 deps | |
| popoverpopover | formscn | Components | Free | 1 dep |
