Card
A container for related content.
import { Card } from "antlitz";
API
| Prop | Type | Default |
|---|---|---|
| asChild | boolean | false |
| interactive | boolean | false |
| radius | "none" | "sm" | "md" | "lg" | "full" | none |
| size | "none" | "sm" | "md" | "lg" | md |
| tone | "base" | "muted" | "subtle" | base |
| variant | "solid" | "soft" | "outline" | "plain" | outline |
size controls padding rather than dimensions; size="none" removes it, which
is what you want when the card holds a full-bleed image.
Variants
export function Variants() {
return (
<>
<Card className="w-36">Outline</Card>
<Card variant="soft" className="w-36">
Soft
</Card>
<Card variant="solid" className="w-36">
Solid
</Card>
<Card variant="plain" className="w-36">
Plain
</Card>
</>
);
}Sizes
export function Sizes() {
return (
<>
<Card size="none" className="w-32">
None
</Card>
<Card size="sm" className="w-32">
Small
</Card>
<Card size="md" className="w-32">
Medium
</Card>
<Card size="lg" className="w-32">
Large
</Card>
</>
);
}Radius
export function Radius() {
return RADII.map((radius) => (
<Card key={radius} radius={radius} className="w-32">
{radius}
</Card>
));
}Tones
export function Tones() {
return (
<>
<Card tone="base" className="w-32">
Base
</Card>
<Card tone="muted" className="w-32">
Muted
</Card>
<Card tone="subtle" className="w-32">
Subtle
</Card>
</>
);
}Interactive
export function Interactive() {
return (
<Card asChild interactive className="w-full max-w-xs">
<Link href="/components/card" variant="plain">
<Heading as="h3" size="xs">
A whole card as one link
</Heading>
<Text size="sm" tone="muted">
Hover and focus affordances come from `interactive`.
</Text>
</Link>
</Card>
);
}interactive adds a pointer cursor and a hover fill for cards that behave as a
single target. Pair it with asChild and a link so the whole card is one
control, rather than nesting a link inside a clickable div — the link then
takes focus and draws the theme's focus ring.
Composition
Starter
CurrentEverything you need to publish your first site.
export function Composition() {
return (
<Card className="flex w-full max-w-xs flex-col gap-3">
<div className="flex items-center justify-between gap-2">
<Heading as="h3" size="xs">
Starter
</Heading>
<Badge size="sm" variant="soft" radius="full">
Current
</Badge>
</div>
<Text size="sm" tone="muted">
Everything you need to publish your first site.
</Text>
<Button size="sm" variant="outline">
Manage plan
</Button>
</Card>
);
}Card is a flex column with overflow-hidden, so a rounded card clips its
children. It sets no gap — spacing between children is the caller's decision.
The border belongs to the outline variant rather than the base: a transparent
border on every variant would inset content by 1px in variants that show no
border, because normal-flow children lay out in the content box.