Skip to main content

Overview

The Card component provides a flexible container with multiple sub-components for building structured content layouts. Includes CardHeader, CardTitle, CardDescription, CardContent, and CardFooter.

Import

Basic Usage

Sub-Components

Card

The root container component.
Styling: Rounded corners, surface background, border, and subtle shadow.

CardHeader

Container for the card’s header section.
Styling: Flex column layout with 4px gap and 16px padding on all sides.

CardTitle

Heading for the card (renders as <h3>).
Styling: 14px (sm) font, semibold weight, foreground color, tight leading.

CardDescription

Subheading or description text (renders as <p>).
Styling: 12px (xs) font, muted foreground color.

CardContent

Main content area of the card.
Styling: Horizontal padding of 16px (4), bottom padding of 16px (4).

CardFooter

Footer section for actions or additional information.
Styling: Flex row layout, items centered, 16px horizontal padding, 16px bottom padding, no top padding.

Props

All Card sub-components extend their respective HTML element attributes:
string
Additional CSS classes for the Card container.
string
Additional CSS classes for CardHeader.
string
Additional CSS classes for CardTitle.
string
Additional CSS classes for CardDescription.
string
Additional CSS classes for CardContent.
Additional CSS classes for CardFooter.

Examples

Complete Card

Simple Card

Custom Styling

Component Definition

Location: packages/gadget-ui/src/components/card.tsx All Card sub-components use forwardRef to support ref forwarding to their underlying HTML elements.