Layout

Card

A surface container that groups related content and actions. Header / title / description / content / footer subcomponents.

Preview
01 Installation

Install

Pull Card from the barrel for everyday use, or the granular path when you want a tighter bundle.

tsxBarrel1 line
import { Card } from "@brika/clay";
tsxGranular1 line
import { Card } from "@brika/clay/components/card";
02 Usage

A minimal example

Drop this into a page. Native HTML attributes pass through to the underlying primitive.

tsxCard.tsx19 lines
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>
  );
}
03 Examples

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.

04 Accessibility

Accessibility

  • Card is a layout container with no implicit role, add role="article" for standalone content.
  • Interactive cards using the interactive prop should also carry tabIndex={0} and onKeyDown for keyboard activation.
  • Accent color is visual only, convey variant meaning through text or aria-label as well.
05 Tokens 22 theme-overridable

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
ColorFill, border, and text colors.6
  • --card-containercolorvar(--card)
    components.card.container

    Card background.

  • --card-labelcolorvar(--card-foreground)
    components.card.label

    Card text color.

  • --card-border-colorcolorvar(--border)
    components.card.borderColor

    Resting border color of a card without an accent stripe.

  • --card-interactive-border-restcolorcolor-mix(in oklch, var(--foreground) 10%, transparent)
    components.card.interactiveBorderRest

    Border 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.interactiveBorderHover

    Border 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.descriptionColor

    Foreground color of `<CardDescription>` text.

GeometrySizes, lengths, and corner radii.4
  • --card-radiusradiusvar(--radius-container)
    components.card.radius

    Card corner radius.

  • --card-padding-xsizecalc(var(--spacing) * 6)
    components.card.paddingX

    Inline padding inside the card.

  • --card-padding-ysizecalc(var(--spacing) * 6)
    components.card.paddingY

    Block padding inside the card.

  • --card-gapsizecalc(var(--spacing) * 4)
    components.card.gap

    Gap between adjacent children inside the card.

BorderBorder width and style.2
  • --card-border-widthborder-width1px
    components.card.borderWidth

    Border width on the card. Set non-zero for outline-style variants.

  • --card-border-styleborder-stylesolid
    components.card.borderStyle

    Border style on the card (`solid`, `dashed`, `double`, `none`).

TypographyTypeface, size, weight, spacing.6
  • --card-font-familyfont-familyvar(--font-sans)
    components.card.fontFamily

    Typeface for card.

  • --card-font-sizefont-sizevar(--text-body-md)
    components.card.fontSize

    Font size for card.

  • --card-font-weightfont-weight500
    components.card.fontWeight

    Font weight for card.

  • --card-line-heightline-height1.25
    components.card.lineHeight

    Line height for card.

  • --card-letter-spacingletter-spacing0
    components.card.letterSpacing

    Letter spacing for card. Useful for caps labels.

  • --card-text-transformtext-transformnone
    components.card.textTransform

    Text transform for card (`uppercase`, `lowercase`, `capitalize`, `none`).

ElevationDrop shadow and depth.2
  • --card-shadowshadowvar(--shadow-raised)
    components.card.shadow

    Card elevation.

  • --card-backdrop-blurblur0px
    components.card.backdropBlur

    Backdrop blur applied behind a translucent card. Set non-zero for glass.

MotionAnimation duration and easing.2
  • --card-durationdurationvar(--motion-standard-duration)
    components.card.duration

    Transition duration for card state changes.

  • --card-easingeasingvar(--motion-standard-easing)
    components.card.easing

    Transition 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.

jsonmy-theme.json12 lines
{
  "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.

06 API reference

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 />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<CardDescription />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<CardFooter />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<CardHeader />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<CardTitle />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.