---
title: "Card"
description: "A bordered box that groups one topic: a header with a title, a description, and an action, then content and a footer. Two sizes; images go edge to edge."
url: https://gelatinui.com/components/card
markdown_url: https://gelatinui.com/components/card.md
access: free
install: "npx shadcn@latest add @gelatin-ui/card"
registry_item: https://gelatinui.com/r/card.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Card

> A bordered box that groups one topic: a header with a title, a description, and an action, then content and a footer. Two sizes; images go edge to edge.

Page: https://gelatinui.com/components/card

## When to use it

Best for: One topic in one box: a title, content, and actions.

- Use it for a single block of content or a grid tile.
- Use `size="sm"` for a dense grid, or a card inside a Dialog.
- Use `flush` when the parts sit between rules.

## When not to use it

- For related panels with a header and a footer outside them, use a [Frame](https://gelatinui.com/components/frame.md).
- For a list of rows, use a list of items, not a card per row.

## Notes for agents

- It is a plain `div` with no role. Put a heading in `CardTitle` when the card starts a section: `<CardTitle><h2>Team</h2></CardTitle>`.
- An image as the first child loses the top padding, and the card clips it to its radius.
- Lines are opt in: `border-b` on the header, `border-t` on the footer.
- `[--card-spacing:…]` changes the padding and the gaps together.

## Anatomy

```text
Card
├─ CardHeader (0..n)
├─ CardTitle (0..n)
├─ CardDescription (0..n)
├─ CardAction (0..n)
├─ CardContent (0..n)
└─ CardFooter (0..n)
```

## API reference

### Card

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `flush` | `boolean` | false |  |
| `size` | `"default" \| "sm"` | "default" |  |
| `variant` | `"dashed" \| "default" \| "selected"` | "default" |  |

### CardHeader

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CardTitle

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CardDescription

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CardAction

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CardContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### CardFooter

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Card | `card` |  | `--card-spacing`, `--spacing` | `motion-timing` |
| CardHeader | `card-header` |  | `--card-spacing` |  |
| CardTitle | `card-title` | `data-size` |  |  |
| CardDescription | `card-description` |  |  |  |
| CardAction | `card-action` |  |  |  |
| CardContent | `card-content` |  | `--card-spacing` |  |
| CardFooter | `card-footer` |  | `--card-spacing` |  |

## Usage

Compose the parts you need.

```tsx title="plan-card.tsx"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";

export function PlanCard() {
  return (
    <Card>
      <CardHeader>
        <CardTitle>Team plan</CardTitle>
        <CardDescription>12 seats, billed each year.</CardDescription>
      </CardHeader>
      <CardContent>Your next invoice is on 1 December 2026.</CardContent>
    </Card>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/card
```

It adds 3 registry items: 2 files, 967 lines, and the npm packages `clsx`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Frame](https://gelatinui.com/components/frame.md): Pick Frame for related panels in a soft tray, with a header and a footer outside the panels.
- [Dialog](https://gelatinui.com/components/dialog.md)
- [Empty](https://gelatinui.com/components/empty.md)

## Accessibility

It has no role, so a screen reader finds it by the heading inside.
