{
  "timestamp": "2026-11-19T09:33:56",
  "compiler": {
    "name": "@stencil/core",
    "version": "4.45.4",
    "typescriptVersion": "5.8.3"
  },
  "storybook": "https://magma-design-system.github.io/magma/storybook/",
  "studio": "https://magma-design-system.github.io/magma/studio/",
  "components": [
    {
      "filePath": "src/components/mds-table/mds-table.tsx",
      "encapsulation": "shadow",
      "tag": "mds-table",
      "docs": "This is a web-component from Maggioli Design System [Magma](https://magma.maggiolicloud.it), built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScript framework you are using.",
      "docsTags": [
        {
          "name": "slot",
          "text": "- Put `mds-table-header`, `mds-table-body`, `mds-table-footer` element/s."
        },
        {
          "name": "slot",
          "text": "batch-action - Put `mds-button` element/s."
        },
        {
          "name": "part",
          "text": "table-wrapper - Selects the element which wraps the table"
        },
        {
          "name": "part",
          "text": "table - Selects the table element"
        },
        {
          "name": "part",
          "text": "batch-actions - Selects the element which wraps the batch actions"
        },
        {
          "name": "part",
          "text": "batch-actions-wrapper - The bar of the batch actions, shown while the table is `selectable` and has `batch-action` content"
        },
        {
          "name": "category",
          "text": "data"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-table>` web component is the root container of the Magma Design System tabular data system. It wraps a native `<table>` and orchestrates a family of compound children (`mds-table-header`, `mds-table-body`, `mds-table-footer`, `mds-table-row`, `mds-table-cell`), propagating interaction, selection, and overflow state down to them.\n\n#### Semantic Behavior\n\n- **Compound parent**: The default slot must hold `mds-table-header` / `mds-table-body` / `mds-table-footer`; `<mds-table>` pushes its own `interactive` and `selectable` state onto every `mds-table-row` and the header/body. It is not used standalone.\n- **Selection model**: When `selectable` is set, rows expose a checkbox; the component aggregates the selected rows, mirrors the count to the header's tristate control, and flags that a selection exists so it is visible to CSS and consumers.\n- **Selection event**: Emits `mdsTableSelectionChange` (bubbles, composed) carrying `{ rows }`, an array of `{ index, value }` for every selected row. It follows every change of a row's `selected`, from its checkbox or from code, and `selectAll(select?)`; changes made together are announced once. Rows that arrive already `selected` (in the markup on load, or rendered later) are counted but not announced, as a native control fires no `change` for its initial value. Both are no-ops unless `selectable` is true.\n- **Live children**: Rows added or removed at runtime are re-wired with the table's interactive and selectable state and counted in the selection, so dynamically added rows behave consistently.\n- **Action overflow**: When rows carry a `[slot=\"action\"]`, rows flip into an overlaid-action mode once content exceeds the visible width. Rows and actions added after the first load are followed too: the header gains its Actions column and the new rows the overlay.\n- **Localization**: Resolves its display language from the page (`<html lang>`: `el`/`en`/`es`/`it`, otherwise `en`) for the batch-actions label.\n\n#### Properties & Visual Configurations\n\n- **`interactive`** highlights rows on mouseover; choose it for tables whose rows are clickable or navigable, not for purely static read-only data.\n- **`selectable`** turns on per-row checkbox selection and the aggregated header/batch-actions machinery; without it the selection methods and the `batch-action` slot are inert.\n- **`selection`** is a read-back flag that becomes true while at least one row is selected - it is managed internally, not something callers normally set.\n- **`sorting`** says who orders the rows when a sortable `mds-table-header-cell` changes direction. `internal` (default) moves the rows in the DOM; `external` leaves them where they are, so the application listens to `mdsTableHeaderCellSort` and renders the rows in the order asked. Choose `external` whenever the table shows one page of a larger set (with `mds-paginator`) or the order comes from a back end: sorting the DOM would only sort the page on screen.\n\n#### Other behavioral props\n\n- **`batch-action` slot** holds `mds-button` element/s; its bar renders only when `selectable` is on and at least one batch action is slotted, surfacing a live count badge of the current selection.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-table>` 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).\n\n#### Basic Read-Only Table\n\nThe minimal structure: `mds-table-header` with one `mds-table-header-cell` per column, `mds-table-body` with `mds-table-row` children each containing `mds-table-cell` elements. All four subparts are required direct children - do not replace them with raw `<thead>`, `<tr>`, or `<td>` elements.\n\n```html\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Nome\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Email\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Data iscrizione\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Mario Rossi</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">mario.rossi@example.com</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">12 ottobre 1985</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Luigi Verdi</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">luigi.verdi@example.com</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">3 marzo 1993</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Layout: Fill the Container and Let the Table Scroll\n\n`<mds-table>` scrolls on its own: its rows sit in an inner wrapper with `overflow: auto`, so when the columns are wider than the table, the table scrolls horizontally inside its own border, and the row actions (`slot=\"action\"`) stay pinned to the visible right edge. It needs no `overflow-x-auto` wrapper of yours, but it needs two things from the page:\n\n- **All the width its container offers**: `w-full` on `<mds-table>`. When that container is a flex or grid item (a `main` next to a sidebar, a `1fr` column), also give the item `min-w-0`: a flex or grid item never shrinks below its content by default, so without it the item grows to the full width of the table and the whole page scrolls instead of the table.\n- **Cells on one line**: `text-wrap: nowrap` on the cells (`[&_mds-table-cell]:text-nowrap` on the table). Wrapping cells squeeze the columns into tall rows and the table never scrolls. `mds-text` with `typography` `paragraph`, `detail` or `caption` sets its own `text-wrap: pretty`, which wins over what it inherits from the cell, so target it too (`[&_mds-text]:text-nowrap`). A long free-text column can keep wrapping if it reads better.\n\n```html\n<div class=\"flex\">\n  <aside class=\"w-6400 shrink-0\">...</aside>\n  <main class=\"min-w-0 flex-1\">\n    <mds-table class=\"w-full [&_mds-table-cell]:text-nowrap [&_mds-text]:text-nowrap\">\n      <mds-table-header>\n        <mds-table-header-cell label=\"Protocollo\"></mds-table-header-cell>\n        <mds-table-header-cell label=\"Oggetto\"></mds-table-header-cell>\n        <mds-table-header-cell label=\"Ufficio\"></mds-table-header-cell>\n        <mds-table-header-cell label=\"Data\"></mds-table-header-cell>\n      </mds-table-header>\n      <mds-table-body>\n        <mds-table-row>\n          <mds-table-cell><mds-text typography=\"detail\">2026/0412</mds-text></mds-table-cell>\n          <mds-table-cell><mds-text typography=\"detail\">Contratto di fornitura servizi cloud 2026-2028</mds-text></mds-table-cell>\n          <mds-table-cell><mds-text typography=\"detail\">Ufficio acquisti e gare</mds-text></mds-table-cell>\n          <mds-table-cell><mds-text typography=\"detail\">12 marzo 2026</mds-text></mds-table-cell>\n        </mds-table-row>\n      </mds-table-body>\n    </mds-table>\n  </main>\n</div>\n```\n\nTo scroll vertically as well, bound the table's height: in a fixed-height panel, make the panel a flex column and give the table `flex-1 min-h-0` (or put `h-full` or a `max-h-*` on the table). The header row scrolls with the body, it is not sticky.\n\n```html\n<section class=\"flex h-9600 flex-col\">\n  <mds-table class=\"min-h-0 flex-1 [&_mds-table-cell]:text-nowrap [&_mds-text]:text-nowrap\">\n    ...\n  </mds-table>\n</section>\n```\n\nWithout Tailwind, the same rules in CSS:\n\n```css\n.content {\n  min-width: 0;\n}\n\n.content mds-table {\n  width: 100%;\n}\n\n.content mds-table-cell,\n.content mds-table-cell mds-text {\n  text-wrap: nowrap;\n}\n```\n\n#### Table with Footer\n\nAdd `mds-table-footer` after `mds-table-body` to show totals or summaries. Each cell inside the footer is an `mds-table-cell` - the same component used in body rows.\n\n```html\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Voce\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Importo\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Servizio A</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">120,00 EUR</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Servizio B</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">80,00 EUR</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n  <mds-table-footer>\n    <mds-table-cell><mds-text typography=\"action\">Totale</mds-text></mds-table-cell>\n    <mds-table-cell><mds-text typography=\"action\">200,00 EUR</mds-text></mds-table-cell>\n  </mds-table-footer>\n</mds-table>\n```\n\n#### Interactive Rows\n\nSet `interactive` when rows are clickable or navigable. The prop propagates to every `mds-table-row` and highlights the hovered row. Do not reach into rows directly to set `interactive` - set it once on the parent.\n\n```html\n<mds-table interactive>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Utente\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Ruolo\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Anna Bianchi</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">Amministratore</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Carlo Neri</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">Operatore</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Row-Level Action Buttons\n\nSlot `mds-button` elements with `slot=\"action\"` directly inside `mds-table-row` (not inside `mds-table-cell`). The table detects the presence of action buttons and switches to overlay-action mode automatically when content overflows the visible width.\n\n```html\n<mds-table interactive>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Documento\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Stato\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Contratto 2024.pdf</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">Approvato</mds-text></mds-table-cell>\n      <mds-button\n        slot=\"action\"\n        icon=\"mi/baseline/download\"\n        title=\"Scarica documento\"\n        variant=\"dark\"\n        tone=\"text\"\n      ></mds-button>\n      <mds-button\n        slot=\"action\"\n        icon=\"mi/baseline/delete\"\n        title=\"Elimina documento\"\n        variant=\"error\"\n        tone=\"text\"\n      ></mds-button>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Row Selection and Selection Event\n\nSet `selectable` to add a checkbox to each row. Listen for `mdsTableSelectionChange` to receive the array of selected rows - each entry carries the row `index` and the optional `value` set on `mds-table-row`. Assign `value` to each row to distinguish selections in the event payload.\n\n```html\n<mds-table selectable id=\"tabella-utenti\">\n  <mds-table-header>\n    <mds-table-header-cell label=\"Nome\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Reparto\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row value=\"usr-001\">\n      <mds-table-cell><mds-text typography=\"detail\">Giulia Russo</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">Contabilita</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row value=\"usr-002\">\n      <mds-table-cell><mds-text typography=\"detail\">Marco Ferrari</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">IT</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n\n<script>\n  document.getElementById('tabella-utenti').addEventListener('mdsTableSelectionChange', (e) => {\n    console.log('Righe selezionate:', e.detail.rows);\n    // e.detail.rows => [{ index: 0, value: 'usr-001' }, ...]\n  });\n</script>\n```\n\n#### Rows Selected on Load\n\nWrite `selected` on the rows that start selected, such as a selection the page restores. The table counts them when it loads, as after a click: the header box turns indeterminate (checked when every row is selected) and the bar of the batch actions shows how many. Rows rendered later already `selected` are counted the same way. `mdsTableSelectionChange` is not emitted for them, as a native control fires no `change` for its initial value: the application wrote them, so it already knows them.\n\n```html\n<mds-table selectable>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Pratica\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row value=\"2026/0097\" selected>\n      <mds-table-cell><mds-text typography=\"detail\">Iscrizione anagrafica</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row value=\"2026/0094\">\n      <mds-table-cell><mds-text typography=\"detail\">Certificato di residenza</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n  <mds-button slot=\"batch-action\" variant=\"primary\" tone=\"outline\" size=\"sm\">Archivia</mds-button>\n</mds-table>\n```\n\n#### Programmatic Select All\n\nCall the `selectAll()` method to select all rows at once; pass `false` to deselect. This is a no-op unless `selectable` is set.\n\n```html\n<mds-button id=\"btn-seleziona-tutti\" label=\"Seleziona tutti\" variant=\"primary\" tone=\"outline\"></mds-button>\n<mds-button id=\"btn-deseleziona\" label=\"Deseleziona tutti\" variant=\"dark\" tone=\"text\"></mds-button>\n\n<mds-table selectable id=\"tabella-doc\">\n  <mds-table-header>\n    <mds-table-header-cell label=\"Titolo\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row value=\"doc-1\">\n      <mds-table-cell><mds-text typography=\"detail\">Verbale assemblea</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row value=\"doc-2\">\n      <mds-table-cell><mds-text typography=\"detail\">Bilancio 2024</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n\n<script>\n  const table = document.getElementById('tabella-doc');\n  document.getElementById('btn-seleziona-tutti').addEventListener('click', () => table.selectAll());\n  document.getElementById('btn-deseleziona').addEventListener('click', () => table.selectAll(false));\n</script>\n```\n\n#### Batch Actions Bar\n\nSlot `mds-button` elements with `slot=\"batch-action\"` as direct children of `mds-table` alongside the body. The bar renders only when `selectable` is set and at least one batch-action button is present, a button added after load included; it shows a live count badge of the current selection and appears once a row is checked.\n\n```html\n<mds-table selectable>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Pratica\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Stato\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row value=\"prat-001\">\n      <mds-table-cell><mds-text typography=\"detail\">Pratica n. 1234</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">In lavorazione</mds-text></mds-table-cell>\n    </mds-table-row>\n    <mds-table-row value=\"prat-002\">\n      <mds-table-cell><mds-text typography=\"detail\">Pratica n. 5678</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">Chiusa</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n  <mds-button\n    slot=\"batch-action\"\n    icon=\"mi/outline/send\"\n    label=\"Invia selezionati\"\n    variant=\"dark\"\n    tone=\"text\"\n  ></mds-button>\n  <mds-button\n    slot=\"batch-action\"\n    icon=\"mi/outline/delete\"\n    label=\"Elimina selezionati\"\n    variant=\"error\"\n    tone=\"text\"\n  ></mds-button>\n</mds-table>\n```\n\n#### Sorting by the Back End, with Pages\n\nWhen the table shows one page of a larger set, set `sorting=\"external\"`: a click on a sortable header emits `mdsTableHeaderCellSort` with the column (`index`, and `sortKey` when the cell has `sort-key`) and the `direction`, and moves no row. The application asks the back end for the first page in that order and renders it; the header shows the direction (icon and `aria-sort`). A `direction` set by the application, for example restored from the address, is shown the same way.\n\n```html\n<mds-table id=\"practices\" sorting=\"external\">\n  <mds-table-header>\n    <mds-table-header-cell label=\"Numero\" sortable sort-key=\"number\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Ricevuta il\" sortable sort-key=\"received\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Oggetto\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <!-- the rows of the current page, rendered by the application -->\n  </mds-table-body>\n</mds-table>\n<mds-paginator id=\"pages\" pages=\"12\"></mds-paginator>\n```\n\n```js\nconst table = document.querySelector('#practices');\nconst pages = document.querySelector('#pages');\n\ntable.addEventListener('mdsTableHeaderCellSort', async (event) => {\n  const { sortKey, direction } = event.detail;\n  // direction \"none\" asks for the order of the back end\n  await loadPage({ page: 1, sort: direction === 'none' ? undefined : { sortKey, direction } });\n  pages.currentPage = 1;\n});\n```\n\n#### Styling Customization\n\nCustomize the table appearance only through its public `--mds-table-*` CSS custom properties: the background, the text colour and the cell padding. Set them on the host element or a parent selector; use the semantic color roles via `rgb(var(--magma-<role>))` so dark mode and themes keep working.\n\n```css\n.tabella-contratti mds-table {\n  --mds-table-background: rgb(var(--magma-surface-raised));\n  --mds-table-cell-padding: calc(var(--spacing) * 500);\n  --mds-table-color: rgb(var(--magma-text-default));\n}\n```\n\nThe frame of the table and the lines inside it - between the rows, under the header, above the footer and at the edge of the batch actions panel - take the `--magma-border-muted` role, so frame and grid read as one and follow the theme and the colour mode.\n",
        "3. Mistakes": "Common incorrect uses of `<mds-table>`. Each entry pairs the wrong form with the right one and a one-line reason. System-wide rules (boolean-as-string, shadow piercing, Tailwind color utilities, raw native event listening) live in [`agents/mistakes.md`](../../../../agents/mistakes.md) - they apply here too but are not repeated.\n\n#### Do Not Replace Compound Subparts with Raw HTML Elements\n\n`<mds-table>` orchestrates its children via internal Stencil mechanisms. Substituting any subpart (`mds-table-header`, `mds-table-body`, `mds-table-row`, `mds-table-cell`) with a raw `<thead>`, `<tbody>`, `<tr>`, or `<td>` breaks propagation of `interactive`, `selectable`, and overflow state.\n\n```html\n<!-- INCORRECT -->\n<mds-table>\n  <thead>\n    <tr><th>Nome</th><th>Email</th></tr>\n  </thead>\n  <tbody>\n    <tr><td>Mario Rossi</td><td>mario.rossi@example.com</td></tr>\n  </tbody>\n</mds-table>\n\n<!-- CORRECT -->\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Nome\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Email\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Mario Rossi</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">mario.rossi@example.com</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Do Not Slot Batch-Action Buttons Inside the Body\n\nThe `slot=\"batch-action\"` must be a direct child of `<mds-table>`, not nested inside `mds-table-body` or any row. The component looks for `:scope > [slot=\"batch-action\"]` on load and whenever its children change, and the bar will not appear if the slot is misplaced.\n\n```html\n<!-- INCORRECT -->\n<mds-table selectable>\n  <mds-table-body>\n    <mds-table-row>...</mds-table-row>\n    <mds-button slot=\"batch-action\" label=\"Elimina\" variant=\"error\" tone=\"text\"></mds-button>\n  </mds-table-body>\n</mds-table>\n\n<!-- CORRECT -->\n<mds-table selectable>\n  <mds-table-header>...</mds-table-header>\n  <mds-table-body>\n    <mds-table-row>...</mds-table-row>\n  </mds-table-body>\n  <mds-button slot=\"batch-action\" label=\"Elimina\" variant=\"error\" tone=\"text\"></mds-button>\n</mds-table>\n```\n\n#### Do Not Slot Row Action Buttons Inside `mds-table-cell`\n\nPer-row action buttons use `slot=\"action\"` on a direct child of `mds-table-row`, not wrapped inside an `mds-table-cell`. Placing them in a cell hides them (`mds-table-cell` has no `action` slot, so the button is not rendered) and breaks the overflow-detection logic that switches rows into overlay-action mode.\n\n```html\n<!-- INCORRECT -->\n<mds-table-row>\n  <mds-table-cell><mds-text typography=\"detail\">Contratto.pdf</mds-text></mds-table-cell>\n  <mds-table-cell>\n    <mds-button slot=\"action\" icon=\"mi/baseline/delete\" title=\"Elimina\" variant=\"error\" tone=\"text\"></mds-button>\n  </mds-table-cell>\n</mds-table-row>\n\n<!-- CORRECT -->\n<mds-table-row>\n  <mds-table-cell><mds-text typography=\"detail\">Contratto.pdf</mds-text></mds-table-cell>\n  <mds-button slot=\"action\" icon=\"mi/baseline/delete\" title=\"Elimina\" variant=\"error\" tone=\"text\"></mds-button>\n</mds-table-row>\n```\n\n#### Do Not Enable Batch Actions Without `selectable`\n\nThe batch-action bar only renders when `selectable` is set. Slotting batch-action buttons on a non-selectable table silently produces no bar and no selection count, causing the buttons to never appear.\n\n```html\n<!-- INCORRECT -->\n<mds-table>\n  <mds-table-header>...</mds-table-header>\n  <mds-table-body>...</mds-table-body>\n  <mds-button slot=\"batch-action\" label=\"Esporta\" variant=\"primary\"></mds-button>\n</mds-table>\n\n<!-- CORRECT -->\n<mds-table selectable>\n  <mds-table-header>...</mds-table-header>\n  <mds-table-body>...</mds-table-body>\n  <mds-button slot=\"batch-action\" label=\"Esporta\" variant=\"primary\"></mds-button>\n</mds-table>\n```\n\n#### Do Not Set `interactive` on Individual Rows\n\n`interactive` is a table-level prop that propagates automatically to every `mds-table-row`. Setting it directly on individual rows bypasses the table's state management and leads to inconsistent behavior when rows are added or removed at runtime.\n\n```html\n<!-- INCORRECT -->\n<mds-table>\n  <mds-table-body>\n    <mds-table-row interactive>...</mds-table-row>\n    <mds-table-row>...</mds-table-row>\n  </mds-table-body>\n</mds-table>\n\n<!-- CORRECT -->\n<mds-table interactive>\n  <mds-table-body>\n    <mds-table-row>...</mds-table-row>\n    <mds-table-row>...</mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Do Not Listen for Native `change` Events to Track Selection\n\nSelection state is communicated via the `mdsTableSelectionChange` custom event. Native `change` events from the internal checkboxes do not bubble out of the shadow DOM reliably; always use the documented Magma event.\n\n```html\n<!-- INCORRECT -->\n<mds-table selectable id=\"tbl\">...</mds-table>\n<script>\n  document.getElementById('tbl').addEventListener('change', (e) => {\n    // unreliable - native events do not bubble from shadow DOM\n  });\n</script>\n\n<!-- CORRECT -->\n<mds-table selectable id=\"tbl\">...</mds-table>\n<script>\n  document.getElementById('tbl').addEventListener('mdsTableSelectionChange', (e) => {\n    console.log('Righe selezionate:', e.detail.rows);\n  });\n</script>\n```\n\n#### Do Not Set `selection` Manually\n\n`selection` is a reflected read-back attribute managed internally by the table. It becomes `true` when at least one row is selected and is intended for CSS attribute selectors or conditional logic in the host app. Setting it from outside does not change which rows are selected and will be overwritten on the next selection update. The table emits `mdsTableSelectionChange` before it updates `selection`, so inside that listener read `e.detail.rows`, not the attribute.\n\n```html\n<!-- INCORRECT -->\n<mds-table selectable selection>\n  ...\n</mds-table>\n\n<!-- CORRECT - read it back, do not set it -->\n<mds-table selectable id=\"tbl\">\n  ...\n</mds-table>\n<script>\n  document.getElementById('tbl').addEventListener('mdsTableSelectionChange', (e) => {\n    const hasSelection = e.detail.rows.length > 0;\n    document.getElementById('panel-azioni').hidden = !hasSelection;\n  });\n</script>\n```\n"
      },
      "props": [
        {
          "name": "interactive",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "interactive",
          "reflectToAttr": false,
          "docs": "Specifies if the table rows are higlighted on mouseover event",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "selectable",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "selectable",
          "reflectToAttr": false,
          "docs": "Specifies if the table rows are selectable by a checkbox",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "selection",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": true,
          "attr": "selection",
          "reflectToAttr": true,
          "docs": "Indicates whether row selection is currently active in the table.",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "sorting",
          "type": "\"external\" | \"internal\" | undefined",
          "complexType": {
            "original": "MdsTableSortingType",
            "resolved": "\"external\" | \"internal\" | undefined",
            "references": {
              "MdsTableSortingType": {
                "location": "import",
                "path": "./meta/type",
                "id": "src/components/mds-table/meta/type.ts::MdsTableSortingType",
                "referenceLocation": "MdsTableSortingType"
              }
            }
          },
          "mutable": false,
          "attr": "sorting",
          "reflectToAttr": true,
          "docs": "Specifies who sorts the rows when a sortable header cell changes direction: `internal` moves\nthem in the DOM, `external` leaves them to the application, which listens to\n`mdsTableHeaderCellSort` and renders the rows in the order asked (a table that shows one page\nof a larger set)",
          "docsTags": [
            {
              "name": "default",
              "text": "'internal'"
            }
          ],
          "default": "'internal'",
          "values": [
            {
              "value": "external",
              "type": "string"
            },
            {
              "value": "internal",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [
        {
          "name": "selectAll",
          "returns": {
            "type": "Promise<void>",
            "docs": ""
          },
          "complexType": {
            "signature": "(select?: boolean) => Promise<void>",
            "parameters": [
              {
                "name": "select",
                "type": "boolean",
                "docs": ""
              }
            ],
            "references": {
              "Promise": {
                "location": "global",
                "id": "global::Promise"
              },
              "HTMLMdsTableRowElement": {
                "location": "global",
                "id": "global::HTMLMdsTableRowElement"
              }
            },
            "return": "Promise<void>"
          },
          "signature": "selectAll(select?: boolean) => Promise<void>",
          "parameters": [
            {
              "name": "select",
              "type": "boolean",
              "docs": ""
            }
          ],
          "docs": "Selects all elements or none, works only if `selectable` is true.",
          "docsTags": []
        },
        {
          "name": "updateActions",
          "returns": {
            "type": "Promise<void>",
            "docs": ""
          },
          "complexType": {
            "signature": "() => Promise<void>",
            "parameters": [],
            "references": {
              "Promise": {
                "location": "global",
                "id": "global::Promise"
              }
            },
            "return": "Promise<void>"
          },
          "signature": "updateActions() => Promise<void>",
          "parameters": [],
          "docs": "`internal` Reads again whether the rows have `slot=\"action\"` content: shows or hides the\nActions column of the header and wires the overlay of the actions. Runs when rows come and\ngo, and mds-table-row calls it when the content of its `action` slot changes.",
          "docsTags": []
        },
        {
          "name": "updateSelection",
          "returns": {
            "type": "Promise<void>",
            "docs": ""
          },
          "complexType": {
            "signature": "() => Promise<void>",
            "parameters": [],
            "references": {
              "Promise": {
                "location": "global",
                "id": "global::Promise"
              },
              "MdsTableRowSelection": {
                "location": "import",
                "path": "./meta/type",
                "id": "src/components/mds-table/meta/type.ts::MdsTableRowSelection",
                "referenceLocation": "MdsTableRowSelection"
              },
              "HTMLMdsTableRowElement": {
                "location": "global",
                "id": "global::HTMLMdsTableRowElement"
              }
            },
            "return": "Promise<void>"
          },
          "signature": "updateSelection() => Promise<void>",
          "parameters": [],
          "docs": "`internal` Updates the selection data event and emits it, it's used to avoid add event listener to the dom and lower performance, works only if `selectable` is true.",
          "docsTags": []
        }
      ],
      "events": [
        {
          "event": "mdsTableSelectionChange",
          "detail": "MdsTableSelectionEventDetail",
          "bubbles": true,
          "complexType": {
            "original": "MdsTableSelectionEventDetail",
            "resolved": "MdsTableSelectionEventDetail",
            "references": {
              "MdsTableSelectionEventDetail": {
                "location": "import",
                "path": "./meta/event-detail",
                "id": "src/components/mds-table/meta/event-detail.ts::MdsTableSelectionEventDetail",
                "referenceLocation": "MdsTableSelectionEventDetail"
              }
            }
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the selection of a `selectable` table changes, with the index and the value of each\nselected row. It announces changes only: not the rows that arrive already `selected` (in the\nmarkup on load, or rendered later), which the table counts all the same, as a native control\nfires no `change` for its initial value",
          "docsTags": []
        }
      ],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-table-actions-gap",
          "annotation": "prop",
          "docs": "Gap between table action elements.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-background",
          "annotation": "prop",
          "docs": "Default background color of the table.",
          "visibility": "public"
        },
        {
          "name": "--mds-table-background-alt",
          "annotation": "prop",
          "docs": "Background color of the rows while a column sorts the table, and of the table behind them.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-border-color",
          "annotation": "prop",
          "docs": "Color of the frame of the table; the lines inside it take --mds-table-separator-color.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-border-width",
          "annotation": "prop",
          "docs": "Width of the table border.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-cell-padding",
          "annotation": "prop",
          "docs": "Padding inside table cells.",
          "visibility": "public"
        },
        {
          "name": "--mds-table-color",
          "annotation": "prop",
          "docs": "Default text color of the table.",
          "visibility": "public"
        },
        {
          "name": "--mds-table-color-alt",
          "annotation": "prop",
          "docs": "Text color of the rows while a column sorts the table.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-separator-color",
          "annotation": "prop",
          "docs": "Color of the lines inside the table: between the rows, under the header, above the footer and at the edge of the batch actions panel.",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Put `mds-table-header`, `mds-table-body`, `mds-table-footer` element/s."
        },
        {
          "name": "batch-action",
          "docs": "Put `mds-button` element/s."
        }
      ],
      "parts": [
        {
          "name": "batch-actions",
          "docs": "Selects the element which wraps the batch actions"
        },
        {
          "name": "batch-actions-wrapper",
          "docs": "The bar of the batch actions, shown while the table is `selectable` and has `batch-action` content"
        },
        {
          "name": "table",
          "docs": "Selects the table element"
        },
        {
          "name": "table-wrapper",
          "docs": "Selects the element which wraps the table"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-text",
        "mds-badge"
      ],
      "dependencyGraph": {
        "mds-table": [
          "mds-text",
          "mds-badge"
        ],
        "mds-badge": [
          "mds-text"
        ]
      },
      "storybook": "layout-table--docs"
    }
  ]
}
