{
  "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-cell/mds-table-cell.tsx",
      "encapsulation": "shadow",
      "tag": "mds-table-cell",
      "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": "- Add `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "parent",
          "text": "mds-table-row mds-table-footer"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-table-cell>` web component is the data-cell building block of the Magma table, designed to be slotted inside [`<mds-table-row>`](../mds-table-row/AGENTS.md). It plays the role of a single table cell (the equivalent of an HTML `<td>`) and wraps arbitrary content with the correct table semantics and styling.\n\n#### Semantic Behavior\n\n- **Compound child only**: Must be placed as a direct slot child of `<mds-table-row>` (or of `<mds-table-footer>`, which is itself a row). It is not used standalone, and a row should not mix cells with unrelated child types. The parent also injects its own `mds-table-cell` instances for the selection checkbox and row actions.\n- **Sorting contribution**: The cell does not sort anything itself, but its `value` is read by `mds-table-header-cell` when sorting a column. If `value` is unset, the header cell falls back to the cell's trimmed text content.\n- **Default slot passthrough**: Any text, HTML or component placed inside is projected as-is; there is no internal layout beyond styling.\n\n#### Properties & Visual Configurations\n\nThis component is essentially a layout/semantic child and exposes a single non-obvious prop:\n\n- **`value`**: Provide this when the cell's visible content is not directly comparable for sorting, when the displayed text differs from the value you want to sort by (e.g. a formatted date or currency string), or to get a numeric sort (two values that both read as numbers, such as `value=\"1250.50\"`, are compared numerically). When omitted, the column sort uses the rendered text content instead.\n\nThere are no `variant` or `tone` props; visual presentation is controlled through the public CSS custom properties listed in [`AGENTS.md`](AGENTS.md): the background and text colors. The cells of the sorted column (the column whose `mds-table-header-cell` has a `direction`) take an alternate tone of their own.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-table-cell>` 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#### Plain Text Cell\n\nThe most common form. Wrap the text in [`<mds-text>`](../mds-text/AGENTS.md) to apply the correct typography style; do not put a bare string directly if you need semantic styling.\n\n```html\n<mds-table-row>\n  <mds-table-cell>\n    <mds-text typography=\"detail\">Mario Rossi</mds-text>\n  </mds-table-cell>\n  <mds-table-cell>\n    <mds-text typography=\"detail\">mario.rossi@esempio.it</mds-text>\n  </mds-table-cell>\n  <mds-table-cell>\n    <mds-text typography=\"detail\">12 ottobre 1985</mds-text>\n  </mds-table-cell>\n</mds-table-row>\n```\n\n#### Sortable Column - Value Matches Displayed Text\n\nWhen the column header is `sortable` and the displayed text is directly sortable as a string, no `value` prop is needed - the sort reads the cell's rendered text content automatically.\n\n```html\n<mds-table-header>\n  <mds-table-header-cell sortable label=\"Cognome\"></mds-table-header-cell>\n  <mds-table-header-cell sortable label=\"Nome\"></mds-table-header-cell>\n</mds-table-header>\n<mds-table-body>\n  <mds-table-row>\n    <mds-table-cell><mds-text typography=\"detail\">Rossi</mds-text></mds-table-cell>\n    <mds-table-cell><mds-text typography=\"detail\">Mario</mds-text></mds-table-cell>\n  </mds-table-row>\n  <mds-table-row>\n    <mds-table-cell><mds-text typography=\"detail\">Verdi</mds-text></mds-table-cell>\n    <mds-table-cell><mds-text typography=\"detail\">Luigi</mds-text></mds-table-cell>\n  </mds-table-row>\n</mds-table-body>\n```\n\n#### Sortable Column - Explicit `value` for Formatted Data\n\nWhen the cell displays a formatted string (currency, localized date, percentage) that does not sort lexicographically, set `value` to the raw comparable form. Values that both read as numbers are compared numerically.\n\n```html\n<mds-table-header>\n  <mds-table-header-cell sortable label=\"Importo\"></mds-table-header-cell>\n  <mds-table-header-cell sortable label=\"Data registrazione\"></mds-table-header-cell>\n</mds-table-header>\n<mds-table-body>\n  <mds-table-row>\n    <!-- numeric value for numeric sort -->\n    <mds-table-cell value=\"1250.50\">\n      <mds-text typography=\"detail\">1.250,50 EUR</mds-text>\n    </mds-table-cell>\n    <!-- value as ISO date string for correct chronological sort -->\n    <mds-table-cell value=\"2024-03-15\">\n      <mds-text typography=\"detail\">15 marzo 2024</mds-text>\n    </mds-table-cell>\n  </mds-table-row>\n  <mds-table-row>\n    <mds-table-cell value=\"340.00\">\n      <mds-text typography=\"detail\">340,00 EUR</mds-text>\n    </mds-table-cell>\n    <mds-table-cell value=\"2023-11-02\">\n      <mds-text typography=\"detail\">2 novembre 2023</mds-text>\n    </mds-table-cell>\n  </mds-table-row>\n</mds-table-body>\n```\n\n#### Cell Containing a Component\n\nThe default slot accepts any HTML or component. Use this to embed status badges, avatars, buttons, or other Magma components inside a cell.\n\n```html\n<mds-table-row>\n  <mds-table-cell>\n    <mds-text typography=\"detail\">Piano Pro</mds-text>\n  </mds-table-cell>\n  <mds-table-cell>\n    <mds-badge variant=\"success\" tone=\"weak\" label=\"Attivo\"></mds-badge>\n  </mds-table-cell>\n  <mds-table-cell>\n    <mds-avatar initials=\"MR\"></mds-avatar>\n  </mds-table-cell>\n</mds-table-row>\n```\n\n#### Footer Cell\n\n`<mds-table-cell>` is used inside [`<mds-table-footer>`](../mds-table-footer/AGENTS.md) for summary rows (totals, counts). The footer is never sorted, so `value` has no effect there.\n\n```html\n<mds-table-footer>\n  <mds-table-cell>\n    <mds-text typography=\"action\">Totale</mds-text>\n  </mds-table-cell>\n  <mds-table-cell>\n    <mds-text typography=\"action\">42 record</mds-text>\n  </mds-table-cell>\n</mds-table-footer>\n```\n\n#### Full Table Composition\n\nThe canonical structure. Each cell sits inside an `mds-table-row` of `mds-table-body`, or directly inside `mds-table-footer` (the header holds `mds-table-header-cell` elements instead), all wrapped by [`<mds-table>`](../mds-table/AGENTS.md).\n\n```html\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell sortable label=\"Utente\"></mds-table-header-cell>\n    <mds-table-header-cell sortable label=\"Email\"></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 value=\"Mario Rossi\">\n        <mds-text typography=\"detail\">Mario Rossi</mds-text>\n      </mds-table-cell>\n      <mds-table-cell value=\"mario.rossi@esempio.it\">\n        <mds-text typography=\"detail\">mario.rossi@esempio.it</mds-text>\n      </mds-table-cell>\n      <mds-table-cell>\n        <mds-badge variant=\"success\" tone=\"weak\" label=\"Attivo\"></mds-badge>\n      </mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell value=\"Luigi Verdi\">\n        <mds-text typography=\"detail\">Luigi Verdi</mds-text>\n      </mds-table-cell>\n      <mds-table-cell value=\"luigi.verdi@esempio.it\">\n        <mds-text typography=\"detail\">luigi.verdi@esempio.it</mds-text>\n      </mds-table-cell>\n      <mds-table-cell>\n        <mds-badge variant=\"error\" tone=\"weak\" label=\"Disabilitato\"></mds-badge>\n      </mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n  <mds-table-footer>\n    <mds-table-cell><mds-text typography=\"action\">2 utenti</mds-text></mds-table-cell>\n    <mds-table-cell></mds-table-cell>\n    <mds-table-cell></mds-table-cell>\n  </mds-table-footer>\n</mds-table>\n```\n\n#### Styling Customization\n\nCustomize cell colors through the public `--mds-table-cell-*` CSS custom properties, the background and the text colour. Set them on the host or on a parent selector; use the semantic color roles via `rgb(var(--magma-<role>))` so dark mode keeps working. The cells of the column the table is sorted by take an alternate tone of their own.\n\n```css\n/* Highlight a column of cells with a custom background */\n.tabella-fatture mds-table-cell.colonna-importo {\n  --mds-table-cell-background: rgb(var(--magma-info-emphasis));\n  --mds-table-cell-color: rgb(var(--magma-info-on-emphasis));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-table-cell>`. 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 Use `<mds-table-cell>` Outside Its Parent Hierarchy\n\n`<mds-table-cell>` is a compound child; it must be placed inside `<mds-table-row>` or `<mds-table-footer>` (themselves inside `<mds-table>`). Rendering it standalone breaks the table layout and ARIA semantics entirely.\n\n```html\n<!-- INCORRECT -->\n<div class=\"my-grid\">\n  <mds-table-cell>Nome</mds-table-cell>\n  <mds-table-cell>Email</mds-table-cell>\n</div>\n\n<!-- CORRECT -->\n<mds-table>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell><mds-text typography=\"detail\">Nome</mds-text></mds-table-cell>\n      <mds-table-cell><mds-text typography=\"detail\">Email</mds-text></mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Do Not Use `<td>` in Place of `<mds-table-cell>`\n\nUsing raw `<td>` inside `<mds-table-row>` bypasses Magma theming, the `sorted` state styles, and the sort-value integration. Always use `<mds-table-cell>`.\n\n```html\n<!-- INCORRECT -->\n<mds-table-row>\n  <td>Mario Rossi</td>\n  <td>mario.rossi@esempio.it</td>\n</mds-table-row>\n\n<!-- CORRECT -->\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@esempio.it</mds-text></mds-table-cell>\n</mds-table-row>\n```\n\n#### Do Not Skip `value` When Displaying Formatted Data in a Sortable Column\n\nIf a cell shows a formatted value (localized date, currency, percentage) and the column is sortable, omitting `value` causes the sort to compare the human-readable strings lexicographically, producing wrong order.\n\n```html\n<!-- INCORRECT: \"12 marzo 2024\" sorts before \"2 gennaio 2024\" lexicographically -->\n<mds-table-cell>\n  <mds-text typography=\"detail\">12 marzo 2024</mds-text>\n</mds-table-cell>\n\n<!-- CORRECT: ISO date in value drives sort; display string is for humans -->\n<mds-table-cell value=\"2024-03-12\">\n  <mds-text typography=\"detail\">12 marzo 2024</mds-text>\n</mds-table-cell>\n```\n\n#### Do Not Style Cells by Piercing Shadow DOM\n\n`<mds-table-cell>` does not expose named `::part()` targets; the supported customization surface is the public `--mds-table-cell-background` and `--mds-table-cell-color`. Targeting internals via `>>>` or undocumented selectors couples your code to implementation details that can change.\n\n```css\n/* INCORRECT */\nmds-table-cell >>> span {\n  color: red;\n}\n\n/* CORRECT */\nmds-table-cell {\n  --mds-table-cell-color: rgb(var(--magma-danger-fg));\n}\n```\n\n#### Do Not Wrap `<mds-table-cell>` in Extra Structural Elements\n\nInserting a `<div>` or `<span>` wrapper around `<mds-table-cell>` inside `<mds-table-row>` breaks the `display: table-cell` layout model and disrupts the column alignment.\n\n```html\n<!-- INCORRECT -->\n<mds-table-row>\n  <div class=\"cell-wrapper\">\n    <mds-table-cell><mds-text typography=\"detail\">Cognome</mds-text></mds-table-cell>\n  </div>\n</mds-table-row>\n\n<!-- CORRECT -->\n<mds-table-row>\n  <mds-table-cell><mds-text typography=\"detail\">Cognome</mds-text></mds-table-cell>\n</mds-table-row>\n```\n"
      },
      "props": [
        {
          "name": "value",
          "type": "number | string | undefined",
          "complexType": {
            "original": "string | number",
            "resolved": "number | string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "value",
          "reflectToAttr": true,
          "docs": "Sets a value to help the sorting function from `mds-table-header-cell`, if not set it will be used the content of the cell.",
          "docsTags": [],
          "values": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-table-cell-background",
          "annotation": "prop",
          "docs": "Default background color of table cells.",
          "visibility": "public"
        },
        {
          "name": "--mds-table-cell-background-alt",
          "annotation": "prop",
          "docs": "Background color of the cells of the sorted column.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-cell-color",
          "annotation": "prop",
          "docs": "Default text color of table cells.",
          "visibility": "public"
        },
        {
          "name": "--mds-table-cell-color-alt",
          "annotation": "prop",
          "docs": "Text color of the cells of the sorted column.",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add `text string`, `HTML elements` or `components` to this slot."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [
        "mds-table-footer",
        "mds-table-header",
        "mds-table-row"
      ],
      "dependencies": [],
      "dependencyGraph": {
        "mds-table-footer": [
          "mds-table-cell"
        ],
        "mds-table-header": [
          "mds-table-cell"
        ],
        "mds-table-row": [
          "mds-table-cell"
        ]
      },
      "storybook": "layout-table-cell--docs"
    }
  ]
}
