Skip to content

Card

Card is a general-purpose container component with a compound component API (Card.Root, Card.Header, Card.Content). It provides consistent surface styling (background, border, border-radius, shadow) for grouping related content.

Import

tsx
import { Card } from "@tailor-platform/app-shell";

Basic Usage

tsx
<Card.Root>
  <Card.Header title="Order Details" description="Summary of order #1234" />
  <Card.Content>
    <p>Content goes here</p>
  </Card.Content>
</Card.Root>

Parts

PartDescription
Card.RootOuter container. Renders a <div> with surface styling applied.
Card.HeaderTop section with an optional title and description.
Card.ContentBody section with consistent horizontal and bottom padding.

Card.Root Props

Card.Root accepts all standard HTML <div> props.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-Card parts and content

Card.Header Props

PropTypeDefaultDescription
titleReact.ReactNode-Card title rendered in a <h3>.
descriptionReact.ReactNode-Supplementary text rendered below the title.
childrenReact.ReactNode-Additional header content rendered after title/description.
classNamestring-Additional CSS classes.

Card.Content Props

Card.Content accepts all standard HTML <div> props.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-Card body content

Examples

Header only

tsx
<Card.Root>
  <Card.Header title="Summary" description="Key metrics for this period" />
</Card.Root>

Content only

tsx
<Card.Root>
  <Card.Content>
    <p>No header needed for this card.</p>
  </Card.Content>
</Card.Root>

Custom header content

tsx
<Card.Root>
  <Card.Header title="Recent Orders">
    <Button size="sm" variant="outline">
      View all
    </Button>
  </Card.Header>
  <Card.Content>
    <Table>{/* ... */}</Table>
  </Card.Content>
</Card.Root>