Card
The mock's .card: radius 22, padding 22, 1px line, its parts 16px apart. lime is the Grow card's tint; footer is its ruled button row; labelledBy names the region (its heading's id; by default its title or <Card.Header> names it). Give it a title (with sub, badge, actions) for the mock's header, or compose one with <Card.Header>.
import { Card } from '@ergasti/bricks';Examples
Card with a header
Card.Header takes a title, a sub line and actions; Card.Body pads the content.
Code
import { Button, Card } from '@ergasti/bricks';
function Basic() {
return (
<div style={{ maxWidth: 460 }}>
<Card>
<Card.Header title="Seat usage" sub="How many creators your plan lets you have" actions={<Button size="sm">Raise limit?</Button>} />
<Card.Body>321 of 400 seats are used.</Card.Body>
</Card>
</div>
);
}Tones
tone="lime" marks a positive or new card; tone="lilac" is the PR portal's soft card (a brand request, a message). Leave tone out for the plain white card, which most cards are. Card.Header's level sets its heading level (default 2), here 3 for cards under a section heading.
Code
import { Card } from '@ergasti/bricks';
function Lime() {
return (
<div style={{ display: 'grid', gap: 16, gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))' }}>
<Card>
<Card.Header level={3} title="Back to campus" sub="Ended · 30 Nov" />
<Card.Body>80 of 80 gifts were taken.</Card.Body>
</Card>
<Card tone="lime">
<Card.Header level={3} title="Winter glow launch" sub="Live · day 13 of 30" />
<Card.Body>68 of 100 gifts have been taken.</Card.Body>
</Card>
<Card tone="lilac">
<Card.Header level={3} title="Brand request" sub="Glow Lab · sent 12 Nov" />
<Card.Body>A December challenge for the new serum, top 10 by sales.</Card.Body>
</Card>
</div>
);
}Header from props
title, sub (as on <Card.Header>), badge and actions draw the card's header for you: a 17px title, the 13px grey line 2px under it, then the status pill and the actions at the end, with the content 16px below. headingLevel (default 2) sets the title's heading level.
Code
import { Button, Card, Pill } from '@ergasti/bricks';
function HeaderProps() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 560 }}>
<Card title="Warehouse details" sub="Every brand sees these on its Gifts page" actions={<Button size="sm" variant="ink">Save</Button>}>
<div>Warehouse 4, Industrial Zone 3, 6th of October City, Giza</div>
</Card>
<Card title="Affiliate program" sub="Since March 2026" badge={<Pill tone="ok">Active</Pill>} headingLevel={3}>
<div>15% of sale on every order with a creator code.</div>
</Card>
</div>
);
}Named regions
A card with a title (or a <Card.Header>) is a region named by its heading, so screen readers can list and jump to it. labelledBy names it by another element's id instead: here the visible heading sits outside the card's own header.
Code
import { Card } from '@ergasti/bricks';
function LabelledBy() {
return (
<div style={{ display: 'grid', gap: 8, maxWidth: 460 }}>
<h3 id="card-ex-stock" style={{ margin: 0 }}>Stock room</h3>
<Card labelledBy="card-ex-stock">
<Card.Body>120 serum sets ready to ship.</Card.Body>
</Card>
</div>
);
}Inset card
variant="inset" is a card inside a drawer section (the PR Portal's creator score card): 16px padding, a line border, no gap between its parts and a 15px title; a paragraph straight inside sits 10px under what is above it.
Code (not run)
import { Card, DetailsBars } from '@ergasti/bricks';
function Inset() {
return (
<div style={{ maxWidth: 372 }}>
<Card variant="inset" title="TRNDR score" headingLevel={3} badge={<b style={{ fontSize: 24 }}>62 <span className="kit-muted" style={{ fontSize: 13 }}>/ 100</span></b>}>
<DetailsBars variant="stacked" label="TRNDR score" bars={[{ label: 'Sales', note: 'EGP 18.2K', value: '30 / 35', percent: 86 }, { label: 'Engagement', note: '3.1%', value: '14 / 20', percent: 70 }]} />
<p className="kit-muted" style={{ fontSize: 12.5 }}>Score = points earned ÷ points we can measure × 100.</p>
</Card>
</div>
);
}Footer and section heading
footer is the card's last row over a rule (14px above and under the line); footerAlign="between" puts Back at the start and Continue at the end. SectionHeading is the same 17px heading over a group of cards, outside any card.
Code
import { Button, Card, SectionHeading } from '@ergasti/bricks';
function FooterAndSection() {
return (
<section aria-labelledby="ex-steps" style={{ display: 'grid', gap: 12, maxWidth: 460 }}>
<SectionHeading id="ex-steps">New challenge</SectionHeading>
<Card title="Basics" footerAlign="between" footer={<><Button variant="ghost" disabled>Back</Button><Button variant="ink">Continue</Button></>}>
<p style={{ margin: 0 }}>Who it's for, the name and the dates.</p>
</Card>
</section>
);
}Props
Prop
Type
Card.Header
Prop
Type
Card.Body
Prop
Type
Design guidance
How the BRICKS design system uses Card. Written in docs/content/components/Card.md; the props above are read from the code, which wins where the two disagree.
The white content card that holds every block on a dashboard page, with an optional header (title, sub line, status badge, actions); use it as the container for any group of related content.
It is the mock's .card: radius 22 (--r-lg), padding 22, 1px --line border, its children 16px apart. Almost every region of both dashboards sits in one: Seat usage and To-do on Home, the creators table, the trend chart on Analytics, the warehouse card on PR Gifts. A titled card is a named <section> region. tone tints it (lime Grow card, lilac PR call to action) and variant="inset" makes the lighter card used inside drawers.
Anatomy
- Section:
section.kit-card, flex column, 16px gap,aria-labelledbyits heading. - Header row (
titleprop or<Card.Header>):.kit-card-h, flex, space-between.- Title:
h2.kit-card-t(level fromheadingLevel), display font 17/700 (15px ininset). - Sub:
.kit-card-sub, 13px--ink-3, 2px under the title. - End:
.kit-card-endholding thebadgethen theactions(wraps as one unit).
- Title:
- Body: your children, or
<Card.Body>(.kit-card-b).
Variants
| Prop value | Look | When to use |
|---|---|---|
variant="default" | Padding 22, 16px gap, 17px title | Every screen. |
variant="inset" | Padding 16, 1px line, no shadow, 0 gap (a direct <p> sits 10px under), 15px title | A card inside a drawer section (PR creator drawer's score card). |
tone unset | --card white | Default. |
tone="lime" | --lime-50 background, #E2F0B5 border, title and sub in --olive | Brand Home › "Grow your program". |
tone="lilac" | --lilac background, #E2D6FF border, --lilac-ink text | PR Portal call-to-action card ("Message creators"). |
headingLevel 2–6 | Same look, different heading tag | 3+ when the card sits under another h2. |
States
Card is static. It has no hover or selected state; put interactive content inside it. Long titles wrap; under 860px the header row wraps so actions drop under the title.
Usage
// Brand › Home › Seat usage
<Card title="Seat usage" sub="How many creators your plan lets you have"
actions={<Button size="sm" onClick={openLimit}>Raise limit?</Button>}>
<Gauge label="Seat usage" max={400} segments={[
{ value: 304, label: 'Selected', tone: 'rasp' },
{ value: 17, label: 'Reserved', tone: 'rasp-soft' },
{ value: 79, label: 'Remaining', tone: 'track' },
]} />
</Card>// A list card: toolbar, table, pager
<Card title="My creators" sub="321 creators in your program">
<ListToolbar search={search} selects={filters} sort={sort} />
<DataTable label="My creators" columns={columns} rows={rows} rowKey={(r) => r.id} onRowClick={openCreator} />
<Pager page={page} lastPage={17} total={321} perPage={20} loading={false} label="My creators" onPage={setPage} />
</Card>// PR Portal › Gift stock › Warehouse (badge + action)
<Card title="Warehouse details" sub="Every brand sees these on its Gifts page"
badge={<Pill tone="ok">Live</Pill>} actions={<Button size="sm" variant="ink">Save</Button>}>
<p>Warehouse 4, Industrial Zone 3, 6th of October City, Giza</p>
</Card>// Inside a drawer section
<Card variant="inset" title="TRNDR score" headingLevel={3} badge={<b>62 / 100</b>}>
<DetailsBars variant="stacked" label="TRNDR score" bars={scoreBars} />
</Card>Where it appears
- In the v3 mocks: Brand › Home › To-do, Seat usage, Top creators this month, Grow your program (lime) (BrandHome); Brand › Analytics › trend chart, Best creators, Best-selling products, Sales by challenge (BrandAnalytics); Brand › Creators, Coupons, Motivation and Payments list cards; PR Portal › content cards on every screen and the creator drawer's score card (
inset, the PR mock'spulseRowscard). - Blocks built on it:
WalletLedger,WalletHealthCard,PayoutWindowCard,GiftStockList,GiftRulesCard, and (library only)MessagesPanel.
Guidelines
Do
- Give every card a
titleunless the content is self-titled; it makes the card a navigable region. - Use
headingLevel={3}for cards nested under a section heading. - Keep header actions to one or two controls.
Don't
- Don't nest a default card inside another card; use
variant="inset"inside drawers only. - Don't use
tonefor status; tones are for call-to-action cards. Status goes inbadge. - Don't add your own margins between cards; the page grid spaces them.
RTL and Arabic
- Header uses flex with logical order: title at the inline start, badge and actions at the inline end.
- Title letter-spacing is reset to 0 in RTL (Arabic must not be tracked).
Tokens
--card, --line, --r-lg, --ink-3, --font-family-display, --tracking-display, --lime-50, --olive, --lilac, --lilac-ink.
Accessibility
- A
<section>; it is named by its heading (aria-labelledby) only when it has atitle, aCard.HeaderorlabelledBy. Then it is a region landmark screen-reader users can jump to. An untitled card is an unnamed section, not a landmark. - Heading level is yours to keep the outline correct (h1 page title → h2 cards).
- Lime and lilac pairs (
--oliveon--lime-50,--lilac-inkon--lilac) meet contrast.
Found in the source
- ARIA attributes set:
aria-labelledby. - Its tests cover: “a 0 sub is shown; labelledBy still names the region”; “a titled card is a region named by its title; labelledBy still wins”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
Tile,KpiCard: figure tiles, not containers.CalloutCard: a tinted card with copy and a call to action.SettingsSection: the settings card with labelled rows.Drawer/DetailsDrawer: side panels; useCard variant="inset"inside them.
See also: Button · Pill · DetailsBars · SectionHeading · Accordion · HeroCard · KeyValue
Source
src/kit/patterns/Card.tsx (line 79) on GitHub.