Skip to content

Card

A flexible content container with three visual variants and composable sub-components.

Preview

Default Card
Surface-1 background with a subtle border. The standard card for most content.
Elevated Card
Surface-2 background with a medium shadow and no visible border.
Outlined Card
Transparent background with a visible border.

Variants

  • Default -- surface-1 background with a subtle border. The standard card for most content.
  • Elevated -- surface-2 background with a medium box shadow and no visible border.
  • Outlined -- transparent background with a stronger visible border.

Sub-components

Sub-componentDescription
Card.HeaderTop section with semibold title text, separated by a bottom border.
Card.FooterBottom section with a top border and slightly darker background.
Card.MediaFull-bleed image or media slot at the top of the card.

Clickable mode

When onClick is provided, the card becomes interactive: the cursor changes to pointer, the border strengthens on hover, and a subtle shadow appears.

Props

Card

PropTypeDefaultDescription
variant'default' | 'elevated' | 'outlined''default'Visual style
onClick() => void--Makes the card clickable
classNamestring--Additional CSS classes
styleReact.CSSProperties--Inline styles
childrenReact.ReactNode--Card content

Card.Header

PropTypeDefaultDescription
childrenReact.ReactNode--Header content (typically a title)
PropTypeDefaultDescription
childrenReact.ReactNode--Footer content (typically actions)

Card.Media

PropTypeDefaultDescription
srcstring--Image source URL
altstring''Image alt text
heightstring | number200Media container height

Code example

React

tsx
import { Card, Button } from '@thepace/lexicon/components';

function ProjectCard() {
  return (
    <Card variant="elevated">
      <Card.Media src="/cover.jpg" alt="Project cover" />
      <Card.Header>Project Alpha</Card.Header>
      <p>A brief description of the project and its current status.</p>
      <Card.Footer>
        <Button variant="ghost" size="sm">Details</Button>
        <Button variant="primary" size="sm">Open</Button>
      </Card.Footer>
    </Card>
  );
}

Vanilla HTML

html
<div class="lex-card lex-card--elevated">
  <img class="lex-card__media" src="/cover.jpg" alt="Project cover" />
  <div class="lex-card__header">Project Alpha</div>
  <div class="lex-card__body">
    <p>A brief description of the project and its current status.</p>
  </div>
  <div class="lex-card__footer">
    <button class="lex-button lex-button--ghost lex-button--sm">Details</button>
    <button class="lex-button lex-button--primary lex-button--sm">Open</button>
  </div>
</div>

CSS class reference

ClassPurpose
.lex-cardBase card styles
.lex-card--defaultDefault variant
.lex-card--elevatedElevated variant
.lex-card--outlinedOutlined variant
.lex-card--clickableClickable hover state
.lex-card__headerHeader section
.lex-card__bodyBody section
.lex-card__footerFooter section
.lex-card__mediaMedia slot

Released under the MIT License. A product by the pace.