UnflowUI
Components

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

PropTypeDefaultDescription
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
titleReactNode—Header title. On a section, the section is labelled by it
descriptionReactNode—Header description, under the title
actionsReactNode—Aligned to the end of the title row (buttons, badges, links)
titleElement'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6''h2'Heading level of the title
footerReactNode—Content rendered after the body
childrenReactNode—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>

Plan

Active

Seats86 of 250
<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)

SlotTypeDescription
headerReactNodeReplaces the whole header (title, description and actions)
Slot PropPropsDescription
headerBaseHTMLProps<HTMLDivElement>The header row
headingRootBaseHTMLProps<HTMLDivElement>Wrapper around the title and description
titleBaseHTMLProps<HTMLHeadingElement>The title heading
descriptionBaseHTMLProps<HTMLParagraphElement>The description
actionsBaseHTMLProps<HTMLDivElement>The actions container
footerBaseHTMLProps<HTMLDivElement>The footer container

Accessibility

  • With a title, a section card is labelled by its heading (aria-labelledby), so it shows up as a named region.
  • Pick titleElement so the heading fits the page outline.