import { Button } from "@senvenli/react/action";
import { Card, CardBody, CardFooter, CardHeader, Text } from "@senvenli/react/display";
export default function Example() {
return (
<div className="max-w-sm">
<Card>
<CardHeader title="Order #1042" subtitle="Placed March 18, 2026" />
<CardBody>
<Text elementType="p">Three items for Ada Lovelace, shipping to London by standard delivery.</Text>
</CardBody>
<CardFooter>
<Button>Print label</Button>
<Button variant="primary">Mark as shipped</Button>
</CardFooter>
</Card>
</div>
);
}import {
Card,
CardHeader,
CardBody,
CardFooter,
CardMedia,
} from "@senvenli/react/display";Examples
With a photo
CardMedia sits flush to the edges at 16:9; without a `src` it shows an icon.import { Card, CardBody, CardHeader, CardMedia, Text } from "@senvenli/react/display";
// A flat placeholder photo drawn in the file, so the example needs no network.
const PHOTO = `data:image/svg+xml,${encodeURIComponent(
`<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900"><rect width="100%" height="100%" fill="hsl(30 30% 62%)"/><text x="50%" y="50%" fill="hsl(30 30% 20%)" font-family="system-ui" font-size="72" text-anchor="middle" dominant-baseline="middle">Standing desk</text></svg>`,
)}`;
export default function Example() {
return (
<div className="grid max-w-2xl gap-ds-200 sm:grid-cols-2">
<Card>
<CardMedia src={PHOTO} />
<CardHeader title="Standing desk" subtitle="Oak, 160 cm" />
<CardBody>
<Text tone="subtle">24 in stock</Text>
</CardBody>
</Card>
<Card>
<CardMedia fallbackIcon="package" />
<CardHeader title="Monitor arm" subtitle="Dual, clamp mount" />
<CardBody>
<Text tone="subtle">No photo yet</Text>
</CardBody>
</Card>
</div>
);
}A card that is a link
The whole tile is one link named by its title, so it holds no other controls.import { Card, CardBody, CardHeader, Badge, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<div className="max-w-sm">
<Card href="#">
<CardHeader title="Project Atlas" subtitle="Website redesign" />
<CardBody>
<Stack direction="horizontal" space="space-100">
<Badge tone="information">In progress</Badge>
<Text tone="subtle">12 open tasks</Text>
</Stack>
</CardBody>
</Card>
</div>
);
}Variants
Raised on the page, outline inside another surface, sunken for summaries.import { Card, CardBody, CardHeader, Text } from "@senvenli/react/display";
export default function Example() {
return (
<div className="grid gap-ds-200 sm:grid-cols-3">
<Card density="compact">
<CardHeader title="Raised" />
<CardBody>
<Text tone="subtle">The default, on the page.</Text>
</CardBody>
</Card>
<Card variant="outline" density="compact">
<CardHeader title="Outline" />
<CardBody>
<Text tone="subtle">Inside cards and settings groups.</Text>
</CardBody>
</Card>
<Card variant="sunken" density="compact">
<CardHeader title="Sunken" />
<CardBody>
<Text tone="subtle">For summaries and code.</Text>
</CardBody>
</Card>
</div>
);
}Guidelines
When to use it
- Grouping content about one object on a page.
- A whole tile that opens a page (href) or a panel (onPress).
Use something else when
- Only a boundary between groups is needed. Separator
Do and avoid
- An interactive card holds no controls except the header menu.
Accessibility
Built in
- An interactive card is one focusable element named by its header title.
You provide
- A CardHeader title, or
aria-labelon an interactive card without one.
API reference
Card
| Prop | Type | Default | Description |
|---|---|---|---|
variant | CardVariant | – |
|
density | Density | – |
|
radius | ComponentRadius | – | Corner radius: |
childrenRequired | React.ReactNode | – | Header, media, body and footer parts. |
aria-label | string | – | The card's name when it is interactive and has no CardHeader title. |
href | string | – | The whole card is a link (the interactive card): one focusable element named by its title. |
onPress | () => void | – | The whole card is a button (opens a panel rather than a page). |
variantCardVariantraisedon the page ·outlineinside cards and settings groups ·sunkenfor summaries and code.densityDensitycompact: 16px padding instead of 24px.radiusComponentRadiusCorner radius:
nonetofull; the design'slarge(or the provider's default) otherwise.childrenRequiredReact.ReactNodeHeader, media, body and footer parts.
aria-labelstringThe card's name when it is interactive and has no CardHeader title.
hrefstringThe whole card is a link (the interactive card): one focusable element named by its title.
onPress() => voidThe whole card is a button (opens a panel rather than a page).
CardHeader
| Prop | Type | Default | Description |
|---|---|---|---|
titleRequired | React.ReactNode | – | |
subtitle | React.ReactNode | – | |
headingLevel | CardHeadingLevel | 3 | Heading level of the title; default 3. |
actions | React.ReactNode | – | At the header's end: a subtle menu button ( |
titleRequiredReact.ReactNodesubtitleReact.ReactNodeheadingLevelCardHeadingLevelDefault3Heading level of the title; default 3.
actionsReact.ReactNodeAt the header's end: a subtle menu button (
Button variant="subtle" iconOnly); stays clickable above an interactive card.
CardBody
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | React.ReactNode | – |
childrenRequiredReact.ReactNode
CardMedia
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | – | The photo, flush to the card edges at 16:9 and covering the frame. |
alt | string | "" | Describes the photo; "" when the title already says what it shows. |
fallbackIcon | IconName | "image" | Shown on |
srcstringThe photo, flush to the card edges at 16:9 and covering the frame.
altstringDefault""Describes the photo; "" when the title already says what it shows.
fallbackIconIconNameDefault"image"Shown on
ds-surface-sunkenwhen there is no photo.