Card
A surface that groups related content.
import { Card } from '@/design-system';Examples
Title and inset
Newest signups
Groups related content.
An inset card
import { Card } from '@/design-system';
export default function CardBasic() {
return (
<Card as="section" title="Newest signups">
<p className="text-muted">Groups related content.</p>
<Card tone="inset" className="mt-4">
An inset card
</Card>
</Card>
);
}Flush
Add overflow-hidden so pictures follow the rounded corners.
The picture reaches the edges.
import { Card } from '@/design-system';
export default function CardFlush() {
return (
<Card flush className="max-w-xs overflow-hidden">
<div className="h-28 bg-accent/20" />
<p className="p-4">The picture reaches the edges.</p>
</Card>
);
}How it works
- The heading is always an
h2. If the page needs another level, leave outtitleand write your own.
Props
Other HTML attributes are passed to the element. The native title tooltip is replaced by the heading.
| Prop | Type | Default | Description |
|---|---|---|---|
as | 'div' | 'section' | 'li' | 'div' | The element to render. |
title | string | — | A level-two heading at the top. |
tone | 'raised' | 'inset' | 'raised' | Inset uses the page background and no shadow, for a card inside a card. |
flush | boolean | false | Removes the padding. |
className | string | — | Extra classes, for spacing or width. Utility classes override the component’s own styles. |
children | ReactNode | — | The content. |
Tokens
| Token | Default | Sets |
|---|---|---|
--card-title-size | 1rem | Title text size |
--card-radius | 0.75rem | Corner radius |
--card-padding | 1.25rem | Padding |
--card-background | --surface | Fill |
--card-border | --border | Border colour |
--card-shadow | none | Shadow |