Skip to content

Layout

Card

tsx
import { Card, CardDescription, CardIcon, CardTitle } from "@cherry-design-system/react";
import { Layers } from "lucide-react";

export function Feature() {
  return (
    <Card variant="outline">
      <CardIcon>
        <Layers />
      </CardIcon>
      <CardTitle level={3}>Token-driven theming</CardTitle>
      <CardDescription>Swap brands and modes from one set of variables.</CardDescription>
    </Card>
  );
}

Card is a bordered or filled surface that groups related content. Compose it with CardIcon, CardTitle and CardDescription. For a metric tile use StatCard instead.

Examples

Variants

outline has a border, elevated adds a shadow, filled uses a subtle fill.

tsx
import { Card } from "@cherry-design-system/react";

export function Variants() {
  return (
    <>
      <Card variant="outline">Outline</Card>
      <Card variant="elevated">Elevated</Card>
      <Card variant="filled">Filled</Card>
    </>
  );
}

Padding

padding is "md" (20px) by default. Use "none" when the content brings its own spacing, such as an edge-to-edge image or a table.

tsx
import { Card } from "@cherry-design-system/react";

export function Paddings() {
  return (
    <>
      <Card padding="sm">Small</Card>
      <Card padding="lg">Large</Card>
      <Card padding="none">
        <img src="/cover.jpg" alt="" />
      </Card>
    </>
  );
}

Interactive card

interactive lifts the card on hover. Use it when the card holds a single link or button that names it.

tsx
import { Card, CardDescription, CardTitle } from "@cherry-design-system/react";

export function DocsCard() {
  return (
    <Card interactive>
      <CardTitle level={3}>
        <a href="/installation">Installation</a>
      </CardTitle>
      <CardDescription>Install the package and import the styles.</CardDescription>
    </Card>
  );
}

Properties

Card

variant"outline" | "elevated" | "filled"

outline (border), elevated (border and shadow), filled (subtle fill). Defaults to "outline".

padding"sm" | "md" | "lg" | "none"

Inner padding. Defaults to "md" (20px).

interactiveboolean

Lifts on hover, for cards that hold a single link or button.

Card renders a <div>, forwards its ref and passes every other <div> attribute through.

CardIcon

childrenReactNoderequired

The icon, for example a lucide element.

CardIcon renders a <span> with aria-hidden="true", forwards its ref and passes other <span> attributes through.

CardTitle

level2 | 3 | 4 | 5 | 6

Heading level. Defaults to 3.

CardTitle renders an <h2> to <h6> heading, forwards its ref and passes other heading attributes through.

CardDescription

CardDescription has no props of its own. It renders a <p>, forwards its ref and passes <p> attributes through.

All parts are safe in Server Components.

Styling

HookValues
Classcherry-card
data-variantoutline, elevated, filled
data-paddingnone, sm, md, lg
Statesdata-interactive, :hover, :focus-within
Partscherry-card__icon, cherry-card__title, cherry-card__description

The surface reads --cherry-bg-elevated, --cherry-bg-subtle, --cherry-border-default, --cherry-radius-lg and the --cherry-elevation-* shadows.

Accessibility

Card has no role of its own. Give it a CardTitle at the right level so the page outline stays correct. An interactive card needs a single link or button inside that names it. CardIcon is decorative and hidden from assistive tech.