Skip to content
Porcelana

Card

Raised or inset surface with header, title, description and footer.

Data & display

Example

Weekday alarm

06:00 · Mon–Fri

Inset card

Recessed into the surface, for grouped settings.

Example.tsx
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
import { Card, CardTitle } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Card

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
idstring–Element id. Generated automatically when omitted.
insetboolean–Recessed instead of raised.

CardTitle

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
idstring–Element id. Generated automatically when omitted.
level2 | 3 | 4 | 5 | 63Heading 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.