Card
tailark-base-ui/cardFreeComponent
Tailark Base UI Card component
See it running
Open the demo on Tailark Base UI
tailark.com/blocks/cardInstall it
npx shadcn@latest add https://tailark.com/r/card.jsonSource
1import * as React from "react"2import { cn } from "@/lib/utils"34type CardProps = React.ComponentProps<"div"> & {5 render?: React.ReactElement6}78function Card({ className, render, children, ...props }: CardProps) {9 const classes = cn(10 "rounded-xl bg-card text-card-foreground shadow ring shadow-black/6.5 ring-border",11 className12 )1314 if (render) {15 const renderProps = render.props as {16 className?: string17 children?: React.ReactNode18 }1920 return React.cloneElement(21 render as React.ReactElement<Record<string, unknown>>,22 {23 ...props,24 className: cn(classes, renderProps.className),25 // Prefer children already provided inside `render={...}`26 children: children ?? renderProps.children,27 }28 )29 }3031 return (32 <div data-slot="card" className={classes} {...props}>33 {children}34 </div>35 )36}3738function CardHeader({ className, ...props }: React.ComponentProps<"div">) {39 return (40 <div41 data-slot="card-header"42 className={cn("flex flex-col gap-1.5 p-6", className)}43 {...props}44 />45 )46}4748function CardTitle({ className, ...props }: React.ComponentProps<"div">) {49 return (50 <div51 data-slot="card-title"52 className={cn("leading-none font-semibold tracking-tight", className)}53 {...props}54 />55 )56}5758function CardDescription({ className, ...props }: React.ComponentProps<"div">) {59 return (60 <div61 data-slot="card-description"62 className={cn("text-sm text-muted-foreground", className)}63 {...props}64 />65 )66}6768function CardContent({ className, ...props }: React.ComponentProps<"div">) {69 return (70 <div71 data-slot="card-content"72 className={cn("p-6 pt-0", className)}73 {...props}74 />75 )76}7778function CardFooter({ className, ...props }: React.ComponentProps<"div">) {79 return (80 <div81 data-slot="card-footer"82 className={cn("flex items-center p-6 pt-0", className)}83 {...props}84 />85 )86}8788export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
What it pulls in
Other registry items
Files it writes
More from Tailark Base UI
All 468 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | Tailark Base UI | Components | Free | 1 dep | |
| Actionnable Illustrationactionnable | Tailark Base UI | Components | Paid | no deps | |
| Comment Illustrationadd-comment | Tailark Base UI | Components | Paid | no deps | |
| Agent Illustrationagent-feedback | Tailark Base UI | Components | Paid | no deps | |
| Agent Illustrationagent-task-planning | Tailark Base UI | Components | Paid | no deps | |
| Agent Illustrationagent-tasks | Tailark Base UI | Components | Paid | no deps | |
| Agent Illustrationagent-workflow | Tailark Base UI | Components | Paid | no deps | |
| Ai Illustrationai-1 | Tailark Base UI | Components | Paid | no deps |
