Card
A raised surface that groups content on the page.
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@unkey/ui";
export default function BasicCard() {
return (
<Card>
<CardHeader>
<CardTitle className="text-base">checkout-api</CardTitle>
<CardDescription>2M requests this week</CardDescription>
</CardHeader>
<CardContent className="text-gray-11 text-sm">
Live in us-east-1 and eu-central-1.
</CardContent>
</Card>
);
}
Elevation
Card, ResourceListContent and settings groups sit slightly above the page. They use shadow-raised: a hairline ring plus a tight, faint shadow, with no border.
The ring is 1px on every screen and uses --hairline, the same colour as borders and dividers.
Use shadow-raised for any surface that sits on the page, such as a card, a tile or a list frame. Keep these flat:
- Controls, badges and code blocks.
- A box inside another card. Do not nest raised surfaces.
- Alerts, callouts and empty states.
- Dialogs, popovers and menus. They use
shadow-floating.
Usage
Prefer Card over a div with rounded-lg border bg-raised. Pass layout classes only.
<Card className="flex flex-col">{children}</Card>
Banner
Put a CardBanner first inside the card to show a warning strip, such as a rolled-back notice. The card ring turns amber while the banner is present, so the whole card reads as not normal. CardBanner owns the strip’s tint, divider and corners, so pass only the content.
<Card>
{isRolledBack && (
<CardBanner>
<RollbackNotice />
</CardBanner>
)}
{children}
</Card>
Do not stack a separate banner div above a card. Its edge and corners compete with the card’s, and a border sits 1px inside the box while shadow-raised draws the card edge 1px outside it.