Loading component…
Loading component…
The card every screen is built from – header with title, quiet line and an action, content and a footer, the whole card a click target and a gray fill when selected
To reuse this local React demo, copy all files from the Code tab into the same folder, then import Card from ./card.
import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card";
export function AgentCard() {
return (
<Card>
<CardHeader
title="Support triage"
description="Sorts new tickets and drafts the first reply"
action={<button aria-label="More">⋯</button>}
/>
<CardContent>142 tickets this week · 96% resolved</CardContent>
<CardFooter>
Running · started 2 min ago
<button style={{ marginInlineStart: "auto" }}>Open</button>
</CardFooter>
</Card>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| Card · as | "div" \| "section" \| "article" \| "li" | "div" | The element it renders as – li inside a <ul> of cards, section or article when it stands for a part of the page |
| Card · interactive | boolean | The whole card is a click target: it lifts on hover and a link or button in the title stretches over the card. Other buttons and links inside stay clickable on their own | |
| Card · selected | boolean | Shown as picked: a gray fill and a firmer edge, no colored ring. Say it to screen readers too – aria-pressed or aria-current on the title's button or link | |
| CardHeader · title | ReactNode | The title, in an h3 by default. A link or button here makes an interactive card clickable | |
| CardHeader · description | ReactNode | A quiet line or two under the title | |
| CardHeader · icon | ReactNode | Something small at the start – an icon, a logo, an agent's mark or a tile with one | |
| CardHeader · action | ReactNode | At the end of the title line, centred on it: an icon button, a menu, a badge | |
| CardHeader · titleAs | "h2" \| "h3" \| "h4" \| "p" | "h3" | The title's element – pick the level that fits your page, or p for cards in a list of choices |
| CardHeader · children | ReactNode | Anything more under the title and description, e.g. a row of badges | |
| CardContent | ComponentProps<"div"> | The card's body – any content | |
| CardFooter | ComponentProps<"div"> | A row at the bottom in quiet 12.5px text, on the gray tray under the card. Status or meta on the start; give the first button marginInlineStart: auto to push the buttons to the end. Put it directly inside Card | |
| ...props | ComponentProps<"div"> | className, style, id, ref, onClick and the rest go to each part's element |
Fills its container's width – set width on a grid or the card's style
Long titles and unbreakable words wrap inside the card instead of pushing it wider; the footer wraps its buttons onto a new line when narrow
No hover lift on touch screens, so it doesn't stick after a tap
Logical properties – right-to-left text mirrors the header and the footer
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.