Card
Raised or inset surface with header, title, description and footer.
Example
Weekday alarm
06:00 · Mon–Fri
Inset card
Recessed into the surface, for grouped settings.
import { Button, Card, CardDescription, CardFooter, CardHeader, CardTitle } from "@porcelana/ui";
export default function Example() {
return (
<div style={{ display: "grid", gap: 20, gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" }}>
<Card>
<CardHeader>
<CardTitle>Weekday alarm</CardTitle>
<CardDescription>06:00 · Mon–Fri</CardDescription>
</CardHeader>
<CardFooter>
<Button variant="soft">Edit</Button>
</CardFooter>
</Card>
<Card inset>
<CardHeader>
<CardTitle>Inset card</CardTitle>
<CardDescription>Recessed into the surface, for grouped settings.</CardDescription>
</CardHeader>
</Card>
</div>
);
}Import
import { Card, CardTitle } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app rootProps
Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.
Card
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | – | Defines a string value that labels the current element. @see aria-labelledby. |
id | string | – | Element id. Generated automatically when omitted. |
inset | boolean | – | Recessed instead of raised. |
CardTitle
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | – | Defines a string value that labels the current element. @see aria-labelledby. |
id | string | – | Element id. Generated automatically when omitted. |
level | 2 | 3 | 4 | 5 | 6 | 3 | Heading level, so cards fit the page outline. Defaults to 3. |
Accessibility
- CardTitle takes a level so cards fit your page's heading outline (default h3).
Mobile
- The footer wraps its buttons onto new lines on narrow screens.