MDX components

Card

Props, examples, and layouts for the Card component in published docs pages

Overview

Card creates a linked tile with a title. You can add a subtitle, description, icon, or image. Use cards for navigation at the start or end of a section: related pages, next steps, feature groups, and external resources. Wrap one or more cards in CardGrid to lay them out as a grid.

Props

PropTypeRequiredDescription
titlestringYesThe card heading.
subtitlestringNoShort label shown with the card, such as "Guide".
descriptionstringNoOne or two sentences describing the destination.
hrefstringNoDestination of the card. Use a page path such as /mdx-components/note, or an https address.
iconstringNoIcon name, such as "rocket", "book", "code", or "settings". Any Lucide icon name works.
imagestringNoImage path or address for the image variant.
variantstringNo"normal" (default), "small", or "image".
externalbooleanNoSet to true for links that leave the site.
classNamestringNoExtra CSS classes for small spacing adjustments.

Icon names accept both camelCase (bookOpen) and kebab-case (book-open).

Basic example

jsx
<CardGrid>
  <Card
    subtitle="Guide"
    title="REST API"
    description="Browse the endpoints and send your first request."
    href="/rest-api/index"
  />
</CardGrid>

Variants

VariantWhen to use it
normalDefault. A full card with subtitle, title, and description.
smallCompact navigation where many links appear together.
imageCards that lead with a picture. Pass the picture in image.
jsx
<CardGrid>
  <Card
    title="Navigation"
    href="/site-settings-pages/navigation"
    icon="settings"
    variant="small"
    description="Set the sidebar structure and page order."
  />
</CardGrid>

Common layouts

Next steps at the end of a page

Place one card group at the end of a page so readers can continue to related topics.

jsx
<CardGrid>
  <Card
    title="Note"
    href="/mdx-components/note"
    description="Add callouts for requirements and warnings."
  />
  <Card
    title="Tabs"
    href="/mdx-components/tabs"
    description="Show per-language or per-platform examples."
  />
</CardGrid>

Set external={true} on links that leave the site. Internal page paths need no extra prop.

jsx
<CardGrid>
  <Card
    title="Overview"
    href="/overview"
    icon="rocket"
    description="Learn what Doxa does and how its parts fit together."
  />
  <Card
    title="Source code"
    href="https://github.com/acme/widget"
    icon="code"
    external={true}
  />
</CardGrid>

Use small cards with an icon for a dense set of links:

jsx
<CardGrid>
  <Card title="REST API" href="/rest-api/index" icon="book" variant="small" />
  <Card title="Navigation" href="/site-settings-pages/navigation" icon="settings" variant="small" />
  <Card title="Source code" href="https://github.com/acme/widget" icon="code" variant="small" external={true} />
</CardGrid>

Usage rules

  • Place CardGrid at the start or end of a section, not between paragraphs.

  • Do not put cards inside a Step or a Note.

  • Use className only for spacing. Positioning classes such as fixed, absolute, sticky, and offset or z-* utilities are removed when the page renders.

  • Keep each card's title short and put detail in description.

Related components:

Cards link to pages. To show content inline, use Note, Tabs, or Step.