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

# mds-table-footer - examples

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

Correct and idiomatic ways to use the `<mds-table-footer>` 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).

#### Summary Row with Column Labels

The most common pattern: a footer row that repeats the column headings as a visual anchor at the bottom of a long table. Place `mds-table-footer` as a direct child of [`mds-table`](../mds-table/AGENTS.md), after `mds-table-body`, containing one `mds-table-cell` per column.

```html
<mds-table>
  <mds-table-header>
    <mds-table-header-cell label="Cognome e nome"></mds-table-header-cell>
    <mds-table-header-cell label="Email"></mds-table-header-cell>
    <mds-table-header-cell label="Data"></mds-table-header-cell>
  </mds-table-header>
  <mds-table-body>
    <mds-table-row>
      <mds-table-cell><mds-text typography="detail">Rossi Mario</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">m.rossi@example.it</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">12 ott 1985</mds-text></mds-table-cell>
    </mds-table-row>
    <mds-table-row>
      <mds-table-cell><mds-text typography="detail">Verdi Luigi</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">l.verdi@example.it</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">3 mar 1993</mds-text></mds-table-cell>
    </mds-table-row>
  </mds-table-body>
  <mds-table-footer>
    <mds-table-cell><mds-text typography="action">Cognome e nome</mds-text></mds-table-cell>
    <mds-table-cell><mds-text typography="action">Email</mds-text></mds-table-cell>
    <mds-table-cell><mds-text typography="action">Data</mds-text></mds-table-cell>
  </mds-table-footer>
</mds-table>
```

#### Totals Row

Use the footer to display computed totals or aggregated values that summarize the body rows. Cell content can be any component accepted by `mds-table-cell`.

```html
<mds-table>
  <mds-table-header>
    <mds-table-header-cell label="Voce di spesa"></mds-table-header-cell>
    <mds-table-header-cell label="Importo"></mds-table-header-cell>
    <mds-table-header-cell label="Stato"></mds-table-header-cell>
  </mds-table-header>
  <mds-table-body>
    <mds-table-row>
      <mds-table-cell><mds-text typography="detail">Licenze software</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">1.200,00 EUR</mds-text></mds-table-cell>
      <mds-table-cell><mds-badge variant="success" tone="weak" label="Approvato"></mds-badge></mds-table-cell>
    </mds-table-row>
    <mds-table-row>
      <mds-table-cell><mds-text typography="detail">Consulenza</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">3.500,00 EUR</mds-text></mds-table-cell>
      <mds-table-cell><mds-badge variant="warning" tone="weak" label="In attesa"></mds-badge></mds-table-cell>
    </mds-table-row>
  </mds-table-body>
  <mds-table-footer>
    <mds-table-cell><mds-text typography="action">Totale</mds-text></mds-table-cell>
    <mds-table-cell><mds-text typography="action">4.700,00 EUR</mds-text></mds-table-cell>
    <mds-table-cell></mds-table-cell>
  </mds-table-footer>
</mds-table>
```

#### Multiple Footer Rows

`mds-table-footer` is a single row, so it never wraps `mds-table-row` (a row nested in a row breaks the column layout). When you need more than one footer row - for example a subtotal row followed by a grand total row - place one `mds-table-footer` per row, one after the other.

```html
<mds-table>
  <mds-table-header>
    <mds-table-header-cell label="Descrizione"></mds-table-header-cell>
    <mds-table-header-cell label="Imponibile"></mds-table-header-cell>
    <mds-table-header-cell label="IVA 22%"></mds-table-header-cell>
  </mds-table-header>
  <mds-table-body>
    <mds-table-row>
      <mds-table-cell><mds-text typography="detail">Servizio A</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">800,00 EUR</mds-text></mds-table-cell>
      <mds-table-cell><mds-text typography="detail">176,00 EUR</mds-text></mds-table-cell>
    </mds-table-row>
  </mds-table-body>
  <mds-table-footer>
    <mds-table-cell><mds-text typography="detail">Subtotale</mds-text></mds-table-cell>
    <mds-table-cell><mds-text typography="detail">800,00 EUR</mds-text></mds-table-cell>
    <mds-table-cell><mds-text typography="detail">176,00 EUR</mds-text></mds-table-cell>
  </mds-table-footer>
  <mds-table-footer>
    <mds-table-cell><mds-text typography="action">Totale</mds-text></mds-table-cell>
    <mds-table-cell><mds-text typography="action">976,00 EUR</mds-text></mds-table-cell>
    <mds-table-cell></mds-table-cell>
  </mds-table-footer>
</mds-table>
```

#### Cell-Level Styling via Parent `--mds-table-*` Custom Properties

`mds-table-footer` has no public CSS custom property: it inherits visual styling from the public CSS custom properties defined on the parent `mds-table`. Set those properties on `mds-table` (or a wrapping selector) to restyle the background, the text colour and the cell padding uniformly across the whole table - including the footer. The line above the footer is part of the grid, so it takes the same colour as the other lines of the table. `--mds-table-cell-padding` takes a single length: the table also halves it and adds it to other measures.

```css
.bilancio-table mds-table {
  --mds-table-background: rgb(var(--magma-surface-raised));
  --mds-table-cell-padding: calc(var(--spacing) * 300);
  --mds-table-color: rgb(var(--magma-text-default));
}
```
