Data display
Card
A surface that groups related content, with Header, Title, Description, Body and Footer parts. No hooks — it renders in React Server Components.
import { Card } from '@reactloom/ui';Examples
Basic
Team plan
Shared workspaces, SSO and audit logs.
import { Button, Card } from '@reactloom/ui';
export default function Example() {
return (
<Card style={{ width: '100%', maxWidth: 400 }}>
<Card.Header>
<Card.Title>Team plan</Card.Title>
<Card.Description>Shared workspaces, SSO and audit logs.</Card.Description>
</Card.Header>
<Card.Body>Up to 50 members, billed annually.</Card.Body>
<Card.Footer>
<Button variant="secondary">Compare plans</Button>
<Button>Upgrade</Button>
</Card.Footer>
</Card>
);
}Variants
Outlined
Default. Hairline border.
Elevated
Soft shadow for emphasis.
Filled
Subtle background, no border.
import { Card, SimpleGrid } from '@reactloom/ui';
export default function Example() {
return (
<SimpleGrid minChildWidth="10rem" gap="4" style={{ width: '100%' }}>
<Card variant="outlined">
<Card.Title>Outlined</Card.Title>
<Card.Description>Default. Hairline border.</Card.Description>
</Card>
<Card variant="elevated">
<Card.Title>Elevated</Card.Title>
<Card.Description>Soft shadow for emphasis.</Card.Description>
</Card>
<Card variant="filled">
<Card.Title>Filled</Card.Title>
<Card.Description>Subtle background, no border.</Card.Description>
</Card>
</SimpleGrid>
);
}Statistic cards
Rendered as <article> with asChild.
Monthly revenue
$84,210
Active seats
1,284
Churn
1.8%
import { Card, HStack, SimpleGrid, Text } from '@reactloom/ui';
import { TrendingDown, TrendingUp } from 'lucide-react';
const stats = [
{ label: 'Monthly revenue', value: '$84,210', delta: '+12.4%', up: true },
{ label: 'Active seats', value: '1,284', delta: '+3.1%', up: true },
{ label: 'Churn', value: '1.8%', delta: '−0.4 pts', up: false },
];
export default function Example() {
return (
<SimpleGrid minChildWidth="11rem" gap="4" style={{ width: '100%' }}>
{stats.map((s) => (
<Card key={s.label} variant="elevated" padding="sm" asChild>
<article>
<Text size="sm" tone="muted">{s.label}</Text>
<Text size="3xl" weight="semibold" tabularNums>{s.value}</Text>
<HStack gap="1">
{s.up ? <TrendingUp size={14} aria-hidden /> : <TrendingDown size={14} aria-hidden />}
<Text as="span" size="sm" tone="success">{s.delta}</Text>
<Text as="span" size="sm" tone="muted">vs last month</Text>
</HStack>
</article>
</Card>
))}
</SimpleGrid>
);
}API reference
Card props
| Prop | Type | Default |
|---|---|---|
variant | 'outlined' | 'elevated' | 'filled' | 'outlined' |
paddingAlso the gap between parts. | 'none' | 'sm' | 'md' | 'lg' | 'md' |
radius | 'none' | 'sm' | 'md' | 'lg' | 'full' | — |
asChildRender as article, section, li, a… | boolean | false |
Parts
| Prop | Type | Default |
|---|---|---|
Card.Title levelHeading level for the outline. | 1–6 | 3 |
Card.Footer justify | 'start' | 'end' | 'between' | 'end' |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
CSS variables
| Variable | Default |
|---|---|
--pl-card-radius | var(--pl-radius-lg |
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-padding] | none · sm · md · lg |
[data-radius] | none · sm · md · lg · full |
[data-variant] | outlined · elevated · filled |
Theme tokens it reads
--pl-color-bg-subtle --pl-color-bg-surface --pl-color-border-default --pl-color-border-subtle --pl-color-fg-default --pl-radius-lg --pl-radius-md --pl-radius-none --pl-radius-sm --pl-radius-xl --pl-shadow-sm
Accessibility
- No implicit role — choose the element with asChild.
- Set Card.Title level to fit the page outline.
Usage guidelines
Do
- Put one primary action in the footer.
Don’t
- Don’t wrap a whole card containing buttons in a link.