Card
A non-interactive surface for a block of content, with an optional header (title, description, actions) and footer.
Overview
Card groups related content on a bordered surface. The header is built from title, description and actions, and the footer from footer; leave them out for a plain container. For a clickable card, use ActionCard.
Import
import { Card } from '@unflowio/ui/components/Card';Props
| Prop | Type | Default | Description |
|---|---|---|---|
as | 'section' | 'div' | 'article' | 'section' | Element rendered as the container |
variant | 'muted' | 'raised' | 'muted' | muted (grey surface) for regular blocks, raised (white) for emphasised panels and forms |
padding | 'none' | 'sm' | 'md' | 'lg' | 'md' | Inner padding: 0, 12, 16 or 24 px |
title | ReactNode | — | Header title. On a section, the section is labelled by it |
description | ReactNode | — | Header description, under the title |
actions | ReactNode | — | Aligned to the end of the title row (buttons, badges, links) |
titleElement | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'h2' | Heading level of the title |
footer | ReactNode | — | Content rendered after the body |
children | ReactNode | — | The body |
Basic usage
Spend this month
Cumulative, including usage
Card content goes here.
<Card title="Spend this month" description="Cumulative, including usage">
<p className="text-sm text-fg">Card content goes here.</p>
</Card>Variants
Muted
Regular blocks
Grey surface.
Raised
Emphasised panels and forms
White surface.
<Card title="Muted" description="Regular blocks">…</Card>
<Card variant="raised" title="Raised" description="Emphasised panels and forms">…</Card>Padding
padding="none"
padding="sm"
padding="md"
padding="lg"
<Card as="div" padding="sm" variant="raised">…</Card>Actions and footer
Plan
Active
<Card
variant="raised"
title="Plan"
actions={<Tag label="Active" variant="greenSecondary" size="sm" />}
footer={<Button label="Manage plan" variant="secondary" size="sm" />}
>
…
</Card>Customization (slots & slotProps)
| Slot | Type | Description |
|---|---|---|
header | ReactNode | Replaces the whole header (title, description and actions) |
| Slot Prop | Props | Description |
|---|---|---|
header | BaseHTMLProps<HTMLDivElement> | The header row |
headingRoot | BaseHTMLProps<HTMLDivElement> | Wrapper around the title and description |
title | BaseHTMLProps<HTMLHeadingElement> | The title heading |
description | BaseHTMLProps<HTMLParagraphElement> | The description |
actions | BaseHTMLProps<HTMLDivElement> | The actions container |
footer | BaseHTMLProps<HTMLDivElement> | The footer container |
Accessibility
- With a
title, asectioncard is labelled by its heading (aria-labelledby), so it shows up as a named region. - Pick
titleElementso the heading fits the page outline.
List
A generic, accessible list that owns keyboard navigation, focus and virtualization, delegating row rendering to a `renderItem` callback — pair it with ListItem for ready-made rows.
SidePanel
A non-modal panel docked beside the content, optionally resizable, with its width remembered between visits.