npx shadcn@4.23.1 add @goop/trail-cardCard
FreeA framed surface that holds one piece of content or a list of settings rows, for React and Tailwind CSS. Free, MIT.
What an agent sees
- CardActionThe tile's action at its top end (12 px in from the top and the end, its items 6 px apart)
- CardTextThe tile's column of words
- CardHeaderThe header inside the list frame, above its rows (a
header, the banner) - CardMediaThe header's picture at its start
- CardContentThe card's padded body
- CardTitleThe title
- CardDescriptionA muted line or two under the card's title that says what the card holds
- CardFooterA small grey line of words, not a footer bar
import { Card, CardAction, CardText, CardHeader, CardMedia, CardContent, CardTitle, CardDescription, CardFooter } from '@/components/ui/goop/card';
import { CardList } from '@/components/ui/goop/card-list';
import { Item, ItemOverlay, ItemContent, ItemTitle, ItemDescription } from '@/components/ui/goop/item';
import { ProgressCircle } from '@/components/ui/goop/progress-circle';
import { Button } from '@/components/ui/goop/button';
<>
<Card variant="outline">
<CardHeader>
<CardTitle asChild>
<h3>Shared folders</h3>
</CardTitle>
<CardDescription>Folders the team can open</CardDescription>
</CardHeader>
<CardContent>Shared last week.</CardContent>
<CardList aria-label="Shared folders" empty={{ title: 'No folders shared yet' }}>
<Item asChild>
<li>
<ItemOverlay asChild>
<a href="/folders/notes" aria-label="Open Field notes" />
</ItemOverlay>
<ItemContent>
<ItemTitle>Field notes</ItemTitle>
<ItemDescription>Notes from the last visit</ItemDescription>
</ItemContent>
</li>
</Item>
</CardList>
</Card>
<Card asChild>
<button type="button" onClick={openSettings}>
<CardText>
<CardTitle>Workspace settings</CardTitle>
<CardDescription>Name, address and defaults</CardDescription>
</CardText>
</button>
</Card>
<Card variant="outline">
<CardHeader>
<CardMedia>
<ProgressCircle
size="lg"
value={42}
max={50}
role="meter"
aria-label="Seats"
aria-valuetext="42 of 50 seats taken"
/>
</CardMedia>
<CardTitle asChild>
<h3>Seats</h3>
</CardTitle>
<CardDescription>42 of 50 taken this month</CardDescription>
<CardAction>
<Button variant="ghost" shape="pill" size="lg" onClick={openSettings}>
Manage seats
</Button>
</CardAction>
</CardHeader>
</Card>
</>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 or a list of settings rows.
When not to use
- To set several cards out in a grid, use CardGrid.
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.
npx shadcn@4.23.1 add @goop/trail-cardAdd the Goop Card to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Card, CardAction, CardText, CardHeader, CardMedia, CardContent, CardTitle, CardDescription, CardFooter } from '@/components/ui/goop/card';
import { CardList } from '@/components/ui/goop/card-list';
import { Item, ItemOverlay, ItemContent, ItemTitle, ItemDescription } from '@/components/ui/goop/item';
import { ProgressCircle } from '@/components/ui/goop/progress-circle';
import { Button } from '@/components/ui/goop/button';
<>
<Card variant="outline">
<CardHeader>
<CardTitle asChild>
<h3>Shared folders</h3>
</CardTitle>
<CardDescription>Folders the team can open</CardDescription>
</CardHeader>
<CardContent>Shared last week.</CardContent>
<CardList aria-label="Shared folders" empty={{ title: 'No folders shared yet' }}>
<Item asChild>
<li>
<ItemOverlay asChild>
<a href="/folders/notes" aria-label="Open Field notes" />
</ItemOverlay>
<ItemContent>
<ItemTitle>Field notes</ItemTitle>
<ItemDescription>Notes from the last visit</ItemDescription>
</ItemContent>
</li>
</Item>
</CardList>
</Card>
<Card asChild>
<button type="button" onClick={openSettings}>
<CardText>
<CardTitle>Workspace settings</CardTitle>
<CardDescription>Name, address and defaults</CardDescription>
</CardText>
</button>
</Card>
<Card variant="outline">
<CardHeader>
<CardMedia>
<ProgressCircle
size="lg"
value={42}
max={50}
role="meter"
aria-label="Seats"
aria-valuetext="42 of 50 seats taken"
/>
</CardMedia>
<CardTitle asChild>
<h3>Seats</h3>
</CardTitle>
<CardDescription>42 of 50 taken this month</CardDescription>
<CardAction>
<Button variant="ghost" shape="pill" size="lg" onClick={openSettings}>
Manage seats
</Button>
</CardAction>
</CardHeader>
</Card>
</>- Fits: states, account, flow, list, overview, record, settings (their recipes).
- CardText is the tile's column of words, with no inside of its own: the tile holds it 12 px in. An outline card's own content (words, MetaFacts, meters) goes under its CardHeader in a
CardContent, never in a CardText or a hand-paddeddiv. An outline card's Item rows go in aCardList(each anItem asChildon anli; a whole row as a link:ItemOverlay asChildround thea), never a bareul; with no rows, itsemptywords show. An outline card's Table goes straight under its CardHeader, never in a CardContent: it takes the card's gutter by itself. A settings card's rows are Fields, not Items:Card variant="outline" asChildround aul, each aField as="li", no CardList. - More on where it goes: card--options.md
- height, width, padding, gap, corner, border, background, shadow, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| variant | default | outline = default | |
| asChild? | boolean = false | Draw the card on your own element (the button or link a tile is). |
- Another example of it: bar-list.md, card-list.md, field.md, item.md, number-input.md, scroll-area.md
| Part | What it is |
|---|---|
| CardAction | The tile's action at its top end (12 px in from the top and the end, its items 6 px apart); its props: card--action.md |
| CardText | The tile's column of words |
| CardHeader | The header inside the list frame, above its rows (a header, the banner) |
| CardMedia | The header's picture at its start |
| CardContent | The card's padded body |
| CardTitle | The title; takes asChild |
| CardDescription | A muted line or two under the card's title that says what the card holds |
| CardFooter | A small grey line of words, not a footer bar |
- 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 6 px apart).
import { CardAction } from '@/components/ui/goop/card';Options
- reveal?: boolean = false — Hidden at rest, shown under the pointer, the press or the keyboard's focus on the card; shown on a touch screen.
Card: every option
import { Card } from '@/components/ui/goop/card';Compose
- A CardHeader holds only its parts, straight in it (no
divround the title and description): aCardMediafirst (a ring, an avatar or an icon tile), itsCardTitle, aCardDescriptionand its action (aCardActionor a Button). CardHeader is the outline card's: in a tile its title stands 16 px further in than the tile's words. A whole tile as a button:Card asChildround the caller'sbutton type="button", a CardText in it. A whole outline card as a button:Card variant="outline" asChildround the button, its words in a CardText withclassName="p-4 max-narrow:p-2.5"(no CardHeader); never round an outline card whose rows hold controls of their own. A border of your own in place of the card's edge takes it away:ring-0 dark:ring-0.
Options
- variant: default (default), outline
- asChild?: boolean = false — Draw the card on your own element (the button or link a tile is).
- Another example of it: bar-list.md, card-list.md, field.md, item.md, number-input.md, scroll-area.md
Accessibility
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
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.