Components/f2a68726-9156-4d92-a3ae-080ef2a643a3

Card

cardfrom shadcn/ui Essentials
Sign in to Add to Project
Card

AI Usage Rules

Use Card as the primary container for grouped content. Compose with CardHeader, CardTitle, CardDescription, CardContent, and CardFooter. Avoid nesting cards.

Code Template

import * as React from "react"
import { cn } from "@/lib/utils"

function Card({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="card" className={cn("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm", className)} {...props} />
}

function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="card-header" className={cn("grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6", className)} {...props} />
}

function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="card-title" className={cn("leading-none font-semibold", className)} {...props} />
}

function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="card-description" className={cn("text-sm text-muted-foreground", className)} {...props} />
}

function CardContent({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="card-content" className={cn("px-6", className)} {...props} />
}

function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
  return <div data-slot="card-footer" className={cn("flex items-center px-6", className)} {...props} />
}

export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }

Props Schema

PropertyTypeDefaultDescription
titlestring
childrenstring
descriptionstring
View raw JSON schema
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string"
    },
    "children": {
      "type": "string"
    },
    "description": {
      "type": "string"
    }
  }
}