Card
A surface that groups related content, with an optional header and footer.
Use a card to group content and actions about one subject, such as a plan, a project or a setting group. Don't nest cards; use spacing or a divider inside one card instead.
Team plan
CurrentRenews on 1 March 2027.
8 of 10 seats used. Add seats before you invite more people.
import { Badge, Button, Card, CardBody, CardFooter, CardHeader } from "@aloxe/react";
export default function CardWithFooter() {
return (
<Card className="w-full max-w-sm">
<CardHeader>
<div className="flex items-center justify-between gap-2">
<h3 className="aloxe-text-heading-4">Team plan</h3>
<Badge tone="accent">Current</Badge>
</div>
<p className="aloxe-text-body-sm text-ax-text-secondary">Renews on 1 March 2027.</p>
</CardHeader>
<CardBody>
<p className="aloxe-text-body-md">8 of 10 seats used. Add seats before you invite more people.</p>
</CardBody>
<CardFooter className="justify-end">
<Button variant="ghost">View invoices</Button>
<Button variant="secondary">Add seats</Button>
</CardFooter>
</Card>
);
}Installation
npm i @aloxe/react @aloxe/tokensThen add the CSS imports from Installation.
Usage
import { Card, CardBody, CardFooter, CardHeader } from "@aloxe/react";
<Card>
<CardHeader>
<h3 className="aloxe-text-heading-4">Team plan</h3>
</CardHeader>
<CardBody>8 of 10 seats used.</CardBody>
<CardFooter className="justify-end">ā¦</CardFooter>
</Card>The parts keep a 24 px rhythm whichever of them you use. Card and its parts are server components.
Examples
Variants
Outlined has a hairline border and sits flat. Elevated has a soft shadow; use it for a card that floats over other content.
Outlined
A hairline border, flat on the page.
Elevated
A soft shadow lifts it off the page.
import { Card, CardHeader } from "@aloxe/react";
export default function CardVariants() {
return (
<div className="@container w-full">
<div className="grid gap-4 @xl:grid-cols-2">
<Card variant="outlined">
<CardHeader>
<h3 className="aloxe-text-heading-4">Outlined</h3>
<p className="aloxe-text-body-sm text-ax-text-secondary">A hairline border, flat on the page.</p>
</CardHeader>
</Card>
<Card variant="elevated">
<CardHeader>
<h3 className="aloxe-text-heading-4">Elevated</h3>
<p className="aloxe-text-body-sm text-ax-text-secondary">A soft shadow lifts it off the page.</p>
</CardHeader>
</Card>
</div>
</div>
);
}Accessibility
A card has no keyboard interaction of its own.
- Put a heading of the right level for the page in
CardHeader, so the card shows up in the page outline. - To make the whole card a link, put the link on the heading text and stretch its hit area, rather than wrapping the card in
<a>.
API reference
Every part accepts className and renders a data-aloxe attribute you can target in CSS, such as [data-aloxe="card"].
Card
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "outlined" | "elevated" | "outlined" | Figma Style. Outlined has a hairline border; elevated has a soft shadow. |
| className | string | Merged with the default classes, e.g. a width. Other props go to the <div>. |
CardHeader
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | A heading of the right level for the page, and optional supporting text. |
CardBody
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | The card content. |
CardFooter
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | Actions sit in a row 8 px apart; add justify-end to push them right. |
Figma
Matches the Card component. Figma Style (Outlined, Elevated) maps to variant. Title, Description and Body are the content of CardHeader and CardBody; Show footer is whether you render CardFooter.
See Figma for where to get the file and how its names map to code.