import { Card } from "@elabs-ai/components-ui";npm install @elabs-ai/components-tokens @elabs-ai/components-uiPaste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.
Add the brand-ui Card component (from @elabs-ai/components-ui) to this project. 1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`. 2. Look Card up before writing code: `npx -y @elabs-ai/components-cli docs Card` prints its real props, variants, what it pairs with and what to avoid. 3. If @elabs-ai/components-ui is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`. 4. Use it here: [the screen or file, and what it should show] 5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop. 6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.
Avoid
- Card inside a Card (nested cards) — flatten; cards are not a generic wrapper.
- Card-for-everything — use a Card only when a bordered surface is the right affordance.
- Identical icon-tile-above-heading Card grids repeated endlessly — vary structure.
Works with
Contains
Examples
Media
`CardMedia` — the media WELL. A faded hairline hatch sits behind whatever the card shows (`ground="dots"` for a dot field, `"none"` for a bare well; `fade` picks the direction it dissolves in). The texture is an inert layer: the media on top of it is never tinted or masked.
Stacked
`stacked` — the edges of two sheets rise behind the card's top edge (the `hairline-stack` utility). It draws OUTSIDE the card: leave ~12px above it and keep it a plain card (a `detail` card clips its overflow).
Interactive
Opt-in hover-lift for clickable cards (gated by the motion system).
Detail Side Fixed
Side panel always visible (default detailReveal).
Detail Side Hover
Side panel revealed on hover / keyboard focus-within (outer card size stays constant).
Detail Bottom Fixed
Bottom panel always visible.
Detail Bottom Hover
Bottom panel revealed on hover / keyboard focus-within.
Interactive With Detail
Proves `interactive` (hover-lift) and `detail` panel coexist without conflict.
Heading Levels
`CardTitle` defaults to a `<div>` (unchanged) but accepts `as` to render a real heading (`h1`-`h6`) so a page built from cards contributes to the document outline (#328). Visual is identical across every tag — only the underlying element and its accessible heading level change.
Description Measure
`CardDescription` gains an opt-in `measure` prop that caps genuine prose to a readable line length (`max-w-prose`, ~65ch) instead of running edge to edge in a wide card (#339). Off by default — short subtitle-style descriptions stay full width.
Detail Hover Keyboard Reveal
Keyboard path: tab into a side+hover card and assert the detail's focusable control is reachable. The `focus-within` CSS selector reveals the panel; DOM assertions confirm the control is present and accessible (layout is opaque to jsdom so we verify focusability, not visual appearance).
API
Card
| Prop | Type | Description |
|---|---|---|
detail | ReactNode | Optional detail-panel content. **Undefined → a plain card** (today's single `<div>` — no grid, no panel, zero behaviour change). |
detailPlacement | "side" | "bottom" | Which edge the detail panel sits on. @default "side" |
detailReveal | "fixed" | "hover" | `fixed` (default, accessible) → panel always visible. `hover` → hidden at rest, revealed on hover **and** keyboard `focus-within` at a FIXED outer footprint (the main content yields the space; no surrounding reflow). Use `hover` for **supplementary** detail only — essential content must use `fixed`. @default "fixed" |
detailSize | string | Detail track size (any CSS length). @default "16rem" (side) / "auto" (bottom) |
detailLabel | string | Accessible label for the detail region. @default "Details" |
stacked | boolean | Opt-in hairline gesture: the edges of two sheets stacked behind the card's top edge (the `hairline-stack` utility). It draws OUTSIDE the card, so it needs ~12px of room above and a card that does not clip — a plain card, not a `detail` one (whose grid is `overflow-hidden`). @default false |
CardAction
CardContent
CardDescription
| Prop | Type | Description |
|---|---|---|
measure | boolean | Cap the line length to a readable prose measure (`max-w-prose`, ~65ch) for genuine paragraph content (#339). Off by default — short, subtitle-style descriptions should stay full width. |
CardFooter
CardHeader
CardMedia
CardTitle
| Prop | Type | Description |
|---|---|---|
as | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | Render as a different element — pick the semantic heading level so a card that titles a real page section contributes to the document outline (#328). The visual (`text-title leading-none`) is identical regardless of tag. @default "div" |
Theming
The tokens each state resolves to. Change the token and every theme follows.
| State | Token |
|---|---|
| background | bg-card text-card-foreground |
| border | border-border |