Github

Card

Displays a card with header, content, and footer sections.

Card Title

Card description goes here

Card content goes here

import { Button } from "@/components/ui/button";
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card";

export function CardDemo() {
  return (
    <Card className="w-[350px]">
      <CardHeader>
        <CardTitle>Card Title</CardTitle>
        <CardDescription>Card description goes here</CardDescription>
      </CardHeader>
      <CardContent>
        <p>Card content goes here</p>
      </CardContent>
      <CardFooter className="flex justify-between">
        <Button variant="outline">Cancel</Button>
        <Button>Submit</Button>
      </CardFooter>
    </Card>
  );
}

Installation

pnpm dlx shadcn@latest add https://components.sudarshandhakal.com.np/r/card.json

Usage

import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card"
<Card>
  <CardHeader>
    <CardTitle>Card Title</CardTitle>
    <CardDescription>Card description</CardDescription>
  </CardHeader>
  <CardContent>
    <p>Card content</p>
  </CardContent>
  <CardFooter>
    <p>Card footer</p>
  </CardFooter>
</Card>

Reference

Components

The Card component consists of the following sub-components:

  • Card - The main card container
  • CardHeader - Container for the card title and description
  • CardTitle - The card title heading
  • CardDescription - The card description text
  • CardContent - Container for the card content
  • CardFooter - Container for the card footer

All components accept standard HTML element props for their respective elements.