card
shadcn/cardFreeComponent
shadcn publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add cardSource
1import * as React from "react"23import { cn } from "@/lib/utils"45const Card = React.forwardRef<6 HTMLDivElement,7 React.HTMLAttributes<HTMLDivElement>8>(({ className, ...props }, ref) => (9 <div10 ref={ref}11 className={cn(12 "rounded-xl border bg-card text-card-foreground shadow",13 className14 )}15 {...props}16 />17))18Card.displayName = "Card"1920const CardHeader = React.forwardRef<21 HTMLDivElement,22 React.HTMLAttributes<HTMLDivElement>23>(({ className, ...props }, ref) => (24 <div25 ref={ref}26 className={cn("flex flex-col space-y-1.5 p-6", className)}27 {...props}28 />29))30CardHeader.displayName = "CardHeader"3132const CardTitle = React.forwardRef<33 HTMLDivElement,34 React.HTMLAttributes<HTMLDivElement>35>(({ className, ...props }, ref) => (36 <div37 ref={ref}38 className={cn("font-semibold leading-none tracking-tight", className)}39 {...props}40 />41))42CardTitle.displayName = "CardTitle"4344const CardDescription = React.forwardRef<45 HTMLDivElement,46 React.HTMLAttributes<HTMLDivElement>47>(({ className, ...props }, ref) => (48 <div49 ref={ref}50 className={cn("text-sm text-muted-foreground", className)}51 {...props}52 />53))54CardDescription.displayName = "CardDescription"5556const CardContent = React.forwardRef<57 HTMLDivElement,58 React.HTMLAttributes<HTMLDivElement>59>(({ className, ...props }, ref) => (60 <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />61))62CardContent.displayName = "CardContent"6364const CardFooter = React.forwardRef<65 HTMLDivElement,66 React.HTMLAttributes<HTMLDivElement>67>(({ className, ...props }, ref) => (68 <div69 ref={ref}70 className={cn("flex items-center p-6 pt-0", className)}71 {...props}72 />73))74CardFooter.displayName = "CardFooter"7576export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
Files it writes
More from shadcn
All 62 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn | Components | Free | no deps | |
| alertalert | shadcn | Components | Free | no deps | |
| alert-dialogalert-dialog | shadcn | Components | Free | no deps | |
| aspect-ratioaspect-ratio | shadcn | Components | Free | no deps | |
| attachmentattachment | shadcn | Components | Free | no deps | |
| avataravatar | shadcn | Components | Free | no deps | |
| badgebadge | shadcn | Components | Free | no deps | |
| breadcrumbbreadcrumb | shadcn | Components | Free | no deps |
