---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Card

A framed surface that holds one piece of content, a list of rows or a section's words, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Card`.

## Try it

Pick any look of the card: the plain outline card or the tile — retitle it, make the whole card one button (hover, press, focus, disabled; a press counts) — the list card (CardList: open a folder, take the rows away to see its empty row and make one from it, put a CardContent above them), or the theme’s own frames as its docs stage draws them (on Trail the outline frame round the theme’s rows: settings, switches, tile rows, sessions, the status card, the profile form …; on Meadow the list, the panel, the tray, the cover, the promo and the drafted email and event), with Disabled holding their controls.

Nothing is saved: a press is only counted, and the rows’ switches and selects hold their own values.

## When to use

- A framed surface that holds one piece of content, a list of rows or a section's words.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Card on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/meadow-card
```

```text
Add the Goop Card to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { CardFooter } from '@/components/ui/goop/card';

import {
  Card,
  CardAction,
  CardContent,
  CardDescription,
  CardHeader,
  CardHeaderButton,
  CardMedia,
  CardSheet,
  CardText,
  CardTitle,
} from '@/components/ui/goop/card';
import { IconButtonIcon } from '@/components/ui/goop/icon-button';

function SurveyTile() {
  return (
    <Card asChild>
      <a href="#ridge">
        <CardText>
          <CardTitle>Ridge survey</CardTitle>
        </CardText>
      </a>
    </Card>
  );
}

function NewEvent({ onAdd, onClose }: { onAdd(): void; onClose(): void }) {
  return (
    <Card variant="tray" size="sm">
      <CardHeader>
        <CardMedia className="bg-fuchsia-fill">
          <IconButtonIcon icon="calendar" box={{ w: 10, h: 10 }} />
        </CardMedia>
        <CardTitle>Calendar</CardTitle>
        <CardAction>
          <CardHeaderButton onClick={onAdd}>Add to calendar</CardHeaderButton>
          <hr />
          <CardHeaderButton aria-label="Dismiss event" onClick={onClose}>
            <IconButtonIcon icon="x" box={{ w: 12, h: 12 }} />
          </CardHeaderButton>
        </CardAction>
      </CardHeader>
      <CardSheet>
        <CardContent>
          <span className="flex items-center gap-1.5">
            <span aria-hidden className="h-4 w-0.5 rounded-sm bg-icon" />
            <CardTitle>Planting day</CardTitle>
          </span>
          <CardDescription>Nov 21, 9–12</CardDescription>
          <CardDescription>Meet at the barn.</CardDescription>
          <span className="my-0.5">mira@example.com</span>
          <span className="my-0.5">Public · Busy</span>
        </CardContent>
      </CardSheet>
    </Card>
  );
}
```

- Fits: states (its recipe).
- The tile's words go in a CardText (CardTitle, CardDescription, CardFooter), its action in a CardAction. The panel's parts go straight in it, in their order: a CardHeader first when it has one, then CardLists and CardContents; its own words, facts or meters in a `CardContent`, never in a `div` padded by hand; a Table straight in it (never in a CardContent), where it takes the card's gutter by itself. A settings card's rows are Fields, not a CardList: `Card variant="outline" asChild` round a `ul` (or a `ul` straight in it, after its CardHeader), each a `Field as="li"`; the card sets each row 12 px in and rules them with its divider.
- More on where it goes: card--options.md
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `variant: default | outline | tray | filled | cover | promo = default`
- `size: md | sm = md`

- Each option with its sentence: card--options.md

### Parts

- `CardHeaderButton` — A quiet button in a card's header strip; also takes type?: 'button' | 'submit' | 'reset' = 'button'; onClick?: (event: MouseEvent) => void; disabled?: boolean
- `CardAction` — The tile's action at its top end (12 px in from the top and the end, its items 8 px apart); in a CardHeader, the header's action at its end, its items 12 px apart, centred on the title's line; its props: card--action.md
- `CardHeader` — The panel's header (a `header`) on the card fill, 12 px in on every side, 42 px tall for one line of words; its title at its start and its action at its end, 10 px apart, centred on the title's line
- `CardMedia` — A picture at the start of a CardList row or a CardHeader
- `CardSheet` — The tray's raised sheet, under its header strip
- `CardContent` — The panel's padded body
- `CardTitle` — The title; takes asChild
- `CardDescription` — A muted line or two under the card's title that says what the card or the row holds
- `CardFooter` — A small grey line of words, not a footer bar

- CardText
- Class recipes (cva): cardVariants (Card)

### CardAction

The tile's action at its top end (12 px in from the top and the end, its items 8 px apart); in a CardHeader, the header's action at its end, its items 12 px apart, centred on the title's line.

```tsx
import { CardAction } from '@/components/ui/goop/card';
```

### Options

- reveal?: boolean = false — A pointer behaviour: hidden at rest, shown under the pointer, the press or the keyboard's focus on the card.

### Card: every option

```tsx
import { Card } from '@/components/ui/goop/card';
```

### Compose

- A CardHeader's parts go straight in it: a `CardMedia` first when there is one, its `CardTitle`, a `CardDescription` and its action (a `CardAction` holding the theme's Button or IconButton). A whole tile as a button: `Card asChild` round the caller's `button type="button"`, a CardText in it; never round a card whose rows hold controls of their own. The tray: a CardHeader (a CardMedia holding a 16 px icon, its CardTitle, a CardAction holding a quiet Button) then one CardSheet holding CardContent sections, each a CardText (CardTitle, CardDescription) and what follows it. The filled panel: a CardHeader (a CardMedia holding a 36 px avatar, its CardTitle, a CardDescription, a CardAction) then a CardContent whose children are its rows, each a `label` holding a CardText and the theme's Switch. The cover: a CardMedia holding the xl solid Avatar — to change the photo, that Avatar `asChild` on a `button type="button"` named for what it does, as a DropdownMenuTrigger's child, its menu's rows the photo's actions — then a CardHeader holding a CardTitle (the name) and a CardDescription (the email). Under it one CardSheet: a draft's `Field orientation="inline"` rows and a `Textarea variant="bare"`, or CardContent sections (a CardTitle, CardDescriptions, your own lines).
- CardHeaderButton: In a CardHeader's CardAction, as `<CardHeaderButton onClick={send}>Send email</CardHeaderButton>`, an `hr`, then `<CardHeaderButton aria-label="Dismiss draft" onClick={dismiss}>` holding one pack icon. The card removes nothing itself: on close, take the card away and move the focus to the next one.

### Options

- variant: default (default), outline, tray, filled, cover, promo
- size: md (default), sm
- asChild?: boolean = false — Draw the card on the caller's own element (the button or link a tile is), merging the card's props onto it.

## Accessibility

- The native element answers the keyboard.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

Shortened to fit: the data-slot values.

## Related

- [Icon button](/themes/meadow/components/icon-button): A button whose one visible label is a pack icon, for toolbars, rows and headers, with a spoken name.
- [Card grid](/themes/meadow/components/card-grid): A grid that sets several cards out in even columns that wrap with its width, for projects, files or features.
- [Item](/themes/meadow/components/item): One row of a list of records.
- [List group](/themes/meadow/components/list-group): A group of a list's rows under a header bar with its name and count that folds open and closed, such as to-dos by project.
