<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-card-content/usage/ in the magma monorepo.
-->

# mds-card-content - examples

> The API of this component: [`AGENTS.md`](AGENTS.md).

Correct and idiomatic ways to use the `<mds-card-content>` component, ordered from most common to most specialized. The examples assume a working knowledge of the shared component rules in [`agents/conventions.md`](../../../../agents/conventions.md).

#### Basic Card with Content

The most common use: a card with only a content region. Place `<mds-card-content>` as a direct child of `<mds-card>` - no `slot` attribute needed, the component self-assigns to the parent's `content` region.

```html
<mds-card>
  <mds-card-content>
    <mds-text typography="label">Comune di Roma</mds-text>
    <mds-text typography="paragraph">Aggiornato il 5 giugno 2026</mds-text>
  </mds-card-content>
</mds-card>
```

#### Full Card Composition

Use `<mds-card-content>` alongside [`<mds-card-header>`](../mds-card-header/AGENTS.md), [`<mds-card-media>`](../mds-card-media/AGENTS.md), and [`<mds-card-footer>`](../mds-card-footer/AGENTS.md) to build a complete card. The parent arranges them in a responsive grid automatically by default (unless `disable-auto-grid` is set on the parent).

```html
<mds-card>
  <mds-card-media>
    <mds-img src="copertina.jpg" alt="Immagine documento"></mds-img>
  </mds-card-media>
  <mds-card-header>
    <mds-text typography="h6">Delibera n. 42</mds-text>
  </mds-card-header>
  <mds-card-content>
    <mds-text typography="paragraph">
      Approvazione del piano triennale delle opere pubbliche per il periodo 2026-2028.
    </mds-text>
  </mds-card-content>
  <mds-card-footer>
    <mds-button label="Scarica PDF" icon="mi/baseline/download" variant="primary"></mds-button>
  </mds-card-footer>
</mds-card>
```

#### Mixed Rich Content

The default slot accepts any HTML or components. Use it for structured content like lists, banners, or data visualizations that make up the card body.

```html
<mds-card>
  <mds-card-header>
    <mds-text typography="h6">Riepilogo pratiche</mds-text>
  </mds-card-header>
  <mds-card-content>
    <mds-banner variant="warning" tone="weak">3 pratiche in scadenza oggi</mds-banner>
    <mds-list>
      <mds-list-item>Pratica SUAP 2026-001</mds-list-item>
      <mds-list-item>Pratica SUAP 2026-002</mds-list-item>
      <mds-list-item>Pratica SUAP 2026-003</mds-list-item>
    </mds-list>
  </mds-card-content>
</mds-card>
```

#### Content-Only Card Without a Header

Omitting sibling regions is valid. A card holding only `<mds-card-content>` renders the content at full height in the grid's single-column layout. This is common for KPI panels or compact info tiles.

```html
<mds-card>
  <mds-card-content>
    <mds-kpi>
      <mds-kpi-item label="142" description="Pratiche aperte"></mds-kpi-item>
    </mds-kpi>
  </mds-card-content>
</mds-card>
```

#### Adjusting Card Spacing via Parent Custom Properties

`<mds-card-content>` has no CSS custom properties and no padding of its own: the card pads its regions with one inset (`--mds-card-padding`, `--magma-rhythm-inset` by default) and sets them `--mds-card-gap` apart (`--magma-rhythm-title-content`). Inside, the content sets its children `--magma-rhythm-title-content` apart, since a card with no header opens its content with its title; rows of data written inside it take their own `gap-between-fields`. Set the card's properties on the `<mds-card>` host or on a parent selector, with a rhythm role.

```css
.scheda-dati mds-card {
  --mds-card-gap: var(--magma-rhythm-between-fields);
}
```
