Card
A surface container that groups related content and actions. Header / title / description / content / footer subcomponents.
Install
Pull Card from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Card } from "@brika/clay";import { Card } from "@brika/clay/components/card";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '@brika/clay/components/card';
/** Plain card with header and body content. */
export default function CardDefaultDemo() {
return (
<Card className="w-72">
<CardHeader>
<CardTitle>Welcome to Clay</CardTitle>
<CardDescription>Pressable raw material for every Brika surface.</CardDescription>
</CardHeader>
<CardContent>Build UI with tokens that travel between apps.</CardContent>
</Card>
);
}Card, every way
Accent
Six accent variants mapped to the theme data-* palette.
Form
Form card pattern, title, inputs, and a footer action.
Interactive
Interactive card with hover lift, wrap in an anchor for full link behaviour.
Stats
Stats card showing a key metric with a trend indicator.
Accessibility
- Card is a layout container with no implicit role, add
role="article"for standalone content. - Interactive cards using the
interactiveprop should also carrytabIndex={0}andonKeyDownfor keyboard activation. - Accent color is visual only, convey variant meaning through text or
aria-labelas well.
Theme tokens
Every CSS variable Card reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Card
without touching component code.
Card tokens
22 tokens--card-containercolorvar(--card)components.card.containerCard background.
--card-labelcolorvar(--card-foreground)components.card.labelCard text color.
--card-border-colorcolorvar(--border)components.card.borderColorResting border color of a card without an accent stripe.
--card-interactive-border-restcolorcolor-mix(in oklch, var(--foreground) 10%, transparent)components.card.interactiveBorderRestBorder color of an interactive (`interactive`) card in its resting state, no accent. The light foreground tint reads as a quiet hairline against either light or dark surfaces.
--card-interactive-border-hovercolorcolor-mix(in oklch, var(--foreground) 20%, transparent)components.card.interactiveBorderHoverBorder color of an interactive card on hover, no accent. Doubles the resting tint to telegraph the interactive affordance.
--card-description-colorcolorvar(--muted-foreground)components.card.descriptionColorForeground color of `<CardDescription>` text.
--card-radiusradiusvar(--radius-container)components.card.radiusCard corner radius.
--card-padding-xsizecalc(var(--spacing) * 6)components.card.paddingXInline padding inside the card.
--card-padding-ysizecalc(var(--spacing) * 6)components.card.paddingYBlock padding inside the card.
--card-gapsizecalc(var(--spacing) * 4)components.card.gapGap between adjacent children inside the card.
--card-border-widthborder-width1pxcomponents.card.borderWidthBorder width on the card. Set non-zero for outline-style variants.
--card-border-styleborder-stylesolidcomponents.card.borderStyleBorder style on the card (`solid`, `dashed`, `double`, `none`).
--card-font-familyfont-familyvar(--font-sans)components.card.fontFamilyTypeface for card.
--card-font-sizefont-sizevar(--text-body-md)components.card.fontSizeFont size for card.
--card-font-weightfont-weight500components.card.fontWeightFont weight for card.
--card-line-heightline-height1.25components.card.lineHeightLine height for card.
--card-letter-spacingletter-spacing0components.card.letterSpacingLetter spacing for card. Useful for caps labels.
--card-text-transformtext-transformnonecomponents.card.textTransformText transform for card (`uppercase`, `lowercase`, `capitalize`, `none`).
--card-shadowshadowvar(--shadow-raised)components.card.shadowCard elevation.
--card-backdrop-blurblur0pxcomponents.card.backdropBlurBackdrop blur applied behind a translucent card. Set non-zero for glass.
--card-durationdurationvar(--motion-standard-duration)components.card.durationTransition duration for card state changes.
--card-easingeasingvar(--motion-standard-easing)components.card.easingTransition easing for card state changes.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.card, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"card": {
"paddingX": "calc(var(--spacing) * 6)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-card-…) — see the
chips on each token row.
API reference
Props specific to Card. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<Card />
2 props- 'none' | 'blue' | 'emerald' | 'violet' | 'orange' | 'purple' | 'amber'Which preset accent color stripe to render along the card edge.
- 'true' | 'false'Enables the hover-lift affordance for clickable cards.
<CardContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CardDescription />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CardFooter />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CardHeader />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<CardTitle />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.