Card

Displays a card with header, content, and footer.

Installation

npx shadcn@latest add card

Usage

Import and use the card component in your project.

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

Examples

Default

A simple card with header, content, and footer.

Card Title
Card Description

Card Content

Card Footer

With Action

A card with an action button in the header.

Card Title
Card Description

Card Content with action in header

Login Form

A card used as a login form.

Login
Enter your email below to login to your account

Notifications

A card showing a list of notifications.

Notifications
You have 3 unread messages.

Push Notifications

Send notifications to device.

Your call has been confirmed.

1 hour ago

You have a new message!

1 hour ago

Your subscription is expiring soon!

2 hours ago

API Reference

Props available for the Card component and its sub-components.

Card

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the card container.

CardHeader

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the header.

CardTitle

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the title.

CardDescription

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the description.

CardContent

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the content area.

CardFooter

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the footer.

CardAction

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the action area in header.