{
  "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-card/mds-card.tsx",
      "encapsulation": "shadow",
      "tag": "mds-card",
      "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": "part",
          "text": "layout - The layout element that wraps the slotted content"
        },
        {
          "name": "slot",
          "text": "media - Add `HTML elements` or `components`Add `HTML elements` or `components`, it is **recommended** to use `mds-img` element or other component to represent media contents, used for images or videos, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        },
        {
          "name": "slot",
          "text": "header - Add `HTML elements` or `components`, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        },
        {
          "name": "slot",
          "text": "content - Add `HTML elements` or `components`, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        },
        {
          "name": "slot",
          "text": "footer - Add `HTML elements` or `components`, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        },
        {
          "name": "category",
          "text": "structure"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-card>` web component is the surface container of the Magma Design System: a styled, self-contained panel that groups related media, heading, body and action content into a single bounded region. It is a pure layout shell built on named slots and compound children rather than a replacement for any single HTML primitive.\n\n#### Semantic Behavior\n\n- **Layout is inferred, not declared**: The card detects which of the `media` / `header` / `content` / `footer` regions are present, again whenever its content changes, and reshapes itself to whatever content you provide.\n- **Compound parent/child relationship**: `<mds-card-media>`, `<mds-card-header>`, `<mds-card-content>` and `<mds-card-footer>` are recognized by tag name and mapped onto the corresponding region, so they slot in without an explicit `slot` attribute. Plain elements given the matching `slot` value land in that region and take part in the managed grid the same way.\n- **Responsive by width**: The card's internal layout switches between stacked and media-beside-content arrangements based on the card's own width, independent of viewport or theme.\n- **One inset, shared by the regions**: The card pads its regions once, with `--magma-rhythm-inset` (600), and sets them `--magma-rhythm-title-content` (300) apart, so the title of a card stands nearer to its content than to the edge. The regions pad nothing of their own (`rhythm/inset`, `rhythm/shared-inset` in the design language).\n- **The media reaches the edges it touches**: `<mds-card-media>` leaves the inset on the sides where it meets the edge of the card: both sides when the regions are stacked, the top too when no header stands above it, the top, the bottom and the start when it stands beside the content. From the other regions it stands 300, as they do from each other (`rhythm/media-bleed`).\n- **The actions stand apart**: The footer stands `--magma-rhythm-content-actions` (600) from the region before it, as the row of actions of a form or of a dialog: the actions act on the whole card, not on its last line (`rhythm/content-actions`).\n- **The footer closes the card**: The footer region sits at the bottom of the card whatever the other regions are. When the card is taller than its parts (a media taller than header and footer together, or a grid row that stretches a set of cards to one height) and there is no content to take the free space, that space stays above the footer, in the card's background.\n- **The card sets the text of its own surface**: It paints `surface-raised` and sets its `color` to `text-default`, the pair the contrast gate measures, so its regions inherit the text of the card, not the colour of what the card stands on: on a band of colour (`surfaces/intro-band`) its text keeps reading without a reset. A `text-*` class or a `color` on the host still wins.\n- **Slot regions are fixed**: Only the four named regions are rendered; there is no default (unnamed) slot, so loose text or elements without a recognized slot/tag are not laid out.\n\n#### Properties & Visual Configurations\n\n`<mds-card>` does not use the shared `variant` / `tone` ladders defined in [`agents/variants.md`](../../../../agents/variants.md); it exposes a single behavioral prop.\n\n- **`disableAutoGrid`** (default `false`) toggles the intrinsic responsive grid. Leave it off to let the card own the placement and reflow of its regions; set it to opt out of the managed grid and lay the slotted content out yourself.\n\nThe inset and the gap follow the rhythm roles, so a density theme moves them with every other space. `--mds-card-padding` and `--mds-card-gap` override them for a set of cards, with another rhythm role, never a step; the background of the card and of its regions is `--mds-card-background`, its text `--mds-card-color`: set them together, so the text keeps reading on the surface.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-card>` 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#### Full Card with All Four Regions\n\nThe most common form. Use `<mds-card-header>`, `<mds-card-media>`, `<mds-card-content>`, and `<mds-card-footer>` as direct children. Each compound child self-assigns to its slot - no explicit `slot` attribute needed.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Titolo della scheda</mds-text>\n  </mds-card-header>\n  <mds-card-media>\n    <mds-img src=\"/immagini/copertina.jpg\" alt=\"Copertina del contenuto della scheda\" class=\"object-cover\"></mds-img>\n  </mds-card-media>\n  <mds-card-content>\n    <mds-text>\n      Descrizione dettagliata del contenuto della scheda.\n    </mds-text>\n  </mds-card-content>\n  <mds-card-footer>\n    <mds-button variant=\"dark\" tone=\"text\" label=\"Annulla\"></mds-button>\n    <mds-button variant=\"primary\" tone=\"strong\" label=\"Conferma\"></mds-button>\n  </mds-card-footer>\n</mds-card>\n```\n\n#### Header + Content (No Media)\n\nOmit the regions you do not need - the card detects which regions are present and adapts its grid layout accordingly. A header-and-content-only card stays single-column.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Riepilogo ordine</mds-text>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>\n      Il tuo ordine e' stato elaborato correttamente.\n    </mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Media + Content + Footer (No Header)\n\nOmitting the header region shifts media to the top and content immediately below. Useful for image-led catalog cards.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/immagini/prodotto.jpg\" alt=\"Il prodotto della gamma autunnale\" class=\"object-cover\"></mds-img>\n  </mds-card-media>\n  <mds-card-content>\n    <mds-text>Descrizione prodotto disponibile nella gamma autunnale.</mds-text>\n  </mds-card-content>\n  <mds-card-footer>\n    <mds-button variant=\"primary\" label=\"Aggiungi al carrello\"></mds-button>\n  </mds-card-footer>\n</mds-card>\n```\n\n#### Header with Action Button via `mds-card-header`\n\n`<mds-card-header>` has a dedicated `action` slot for icon buttons placed in the trailing position. Use it instead of laying out the button manually.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Profilo utente</mds-text>\n    <mds-button\n      slot=\"action\"\n      icon=\"mi/round/more-vert\"\n      aria-label=\"Altre azioni\"\n      variant=\"dark\"\n      tone=\"text\"\n    ></mds-button>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Mario Rossi - Amministratore di sistema</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Media with Overlay Content via `mds-card-media`\n\n`<mds-card-media>` exposes a `content` slot that renders in front of the media element. Use it for captions, badges, or status chips overlaid on an image.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/immagini/evento.jpg\" alt=\"Il palco della conferenza annuale\" class=\"object-cover\"></mds-img>\n    <mds-badge slot=\"content\" variant=\"info\" tone=\"strong\">In corso</mds-badge>\n  </mds-card-media>\n  <mds-card-content>\n    <mds-text typography=\"h6\">Conferenza annuale 2025</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Using Raw Slot Attributes Instead of Compound Children\n\nWhen the compound children (`mds-card-*`) do not fit the use case, assign the `slot` attribute directly on any element, with the same four values: `media`, `header`, `content`, and `footer`. The card reads the regions from the `slot` values, so plain elements get the same managed grid and the same inset as the compound children: do not pad them.\n\n```html\n<mds-card>\n  <div slot=\"header\" class=\"flex items-center gap-inline\">\n    <mds-avatar initials=\"LB\"></mds-avatar>\n    <mds-text typography=\"h6\">Luca Bianchi</mds-text>\n  </div>\n  <mds-img slot=\"media\" src=\"/immagini/lavoro.jpg\" alt=\"Luca Bianchi in cantiere\" class=\"object-cover\"></mds-img>\n  <mds-text slot=\"content\">\n    Responsabile del progetto infrastrutture.\n  </mds-text>\n</mds-card>\n```\n\n#### Disabling the Auto-Grid\n\nSet `disable-auto-grid` to opt out of the managed responsive grid. The regions stack in slot order (media, header, content, footer), whatever their order in the markup, and you own all layout decisions.\n\n```html\n<mds-card disable-auto-grid>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Layout personalizzato</mds-text>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Il contenuto e' disposto senza griglia automatica.</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Styling Customization via CSS Custom Properties\n\nThe card already takes its inset and its gap from the rhythm roles (`--magma-rhythm-inset`, `--magma-rhythm-title-content`), and a density theme moves them. Set `--mds-card-gap` and `--mds-card-padding` on the host or a parent selector only to give a set of cards another relation of the rhythm, written as its role, never as a step. `--mds-card-background` recolors the card and its regions together, `--mds-card-color` their text (`text-default` by default); name a surface role and the text role that reads on it, so dark mode keeps working.\n\n```css\n.scheda-dati mds-card {\n  --mds-card-gap: var(--magma-rhythm-between-fields);\n  --mds-card-background: rgb(var(--magma-surface-overlay));\n}\n\n.scheda-invertita mds-card {\n  --mds-card-background: rgb(var(--magma-surface-inverse));\n  --mds-card-color: rgb(var(--magma-on-inverse));\n}\n```\n\n#### Customizing the Layout Part\n\nThe inner grid element is exposed as `::part(layout)`. Use it only for layout-level overrides that the CSS custom properties cannot cover, such as overriding the `border-radius` of the inner container.\n\n```css\n.scheda-highlight mds-card::part(layout) {\n  border-radius: var(--magma-radius-xl);\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-card>`. 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 Put Content Outside the Four Named Slots\n\n`<mds-card>` has no default (unnamed) slot. Loose text or elements placed without a recognized `slot` attribute - or without using an `mds-card-*` compound child - are silently ignored and never rendered.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <p>Questo testo non verra' mai visualizzato.</p>\n  <mds-button label=\"Azione\"></mds-button>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-content>\n    <mds-text>Questo testo e' correttamente posizionato nel content slot.</mds-text>\n  </mds-card-content>\n  <mds-card-footer>\n    <mds-button label=\"Azione\" variant=\"primary\"></mds-button>\n  </mds-card-footer>\n</mds-card>\n```\n\n#### Do Not Use `mds-card-*` Children Outside `<mds-card>`\n\nCompound children (`mds-card-header`, `mds-card-media`, `mds-card-content`, `mds-card-footer`) rely on `<mds-card>` for layout context. Used standalone they render without the managed grid and without the card's visual chrome.\n\n```html\n<!-- INCORRECT -->\n<div class=\"mia-sezione\">\n  <mds-card-header>\n    <mds-text typography=\"h6\">Titolo standalone</mds-text>\n  </mds-card-header>\n</div>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Titolo nella scheda</mds-text>\n  </mds-card-header>\n</mds-card>\n```\n\n#### Do Not Pierce the Shadow DOM with Undocumented Selectors\n\nThe only supported customization surface is `--mds-card-background`, `--mds-card-color`, `--mds-card-gap`, `--mds-card-padding`, and `::part(layout)`. Targeting internal class names with `>>>`, `/deep/`, or any selector that reaches inside the shadow root couples your code to implementation details and will break on minor releases.\n\n```css\n/* INCORRECT */\nmds-card >>> .layout {\n  padding: 16px;\n}\nmds-card .layout--cfhm {\n  grid-template-columns: 1fr 1fr;\n}\n\n/* CORRECT */\nmds-card {\n  --mds-card-padding: calc(var(--spacing) * 400);\n}\nmds-card::part(layout) {\n  border-radius: var(--magma-radius-xl);\n}\n```\n\n#### Do Not Assign an Explicit `slot` Attribute to `mds-card-*` Children\n\n`mds-card-header`, `mds-card-media`, `mds-card-content`, and `mds-card-footer` already set their own `slot` attribute on the host element from inside the component. Adding it again from the outside is redundant and may conflict with internal wiring.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-header slot=\"header\">...</mds-card-header>\n  <mds-card-content slot=\"content\">...</mds-card-content>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>...</mds-card-header>\n  <mds-card-content>...</mds-card-content>\n</mds-card>\n```\n\n#### Do Not Put Media Elements Directly in the `header` Slot\n\nThe `header` slot is intended for title and action controls. Placing an `<mds-img>` or `<img>` directly there bypasses the media region's responsive two-column behavior. Use the `media` slot (or `<mds-card-media>`) for images and videos.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-img src=\"/immagini/banner.jpg\" alt=\"Banner della campagna\"></mds-img>\n  </mds-card-header>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/immagini/banner.jpg\" alt=\"Banner della campagna\" class=\"object-cover\"></mds-img>\n  </mds-card-media>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Titolo della scheda</mds-text>\n  </mds-card-header>\n</mds-card>\n```\n\n#### Do Not Pad the Regions of a Card\n\nThe card pads its regions once, with its inset. A padding on a region, or on a plain element in a slot, adds to the inset: the title moves away from the edge and from its content, as when every region padded `p-400` of its own and the title stood 800 from its text. A padding on the media also takes it away from the edges it should reach.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-header class=\"p-400\">\n    <mds-text typography=\"h6\">Riepilogo ordine</mds-text>\n  </mds-card-header>\n  <mds-text slot=\"content\" class=\"px-400\">Il tuo ordine e' stato elaborato correttamente.</mds-text>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h6\">Riepilogo ordine</mds-text>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Il tuo ordine e' stato elaborato correttamente.</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Do Not Override Card Dimensions with Inline Styles\n\n`<mds-card>` manages its own min-height and responsive grid. A fixed `height` clips the regions (the card hides its overflow), and a fixed `width` pins the container-query layout instead of letting it follow the space its container gives.\n\n```html\n<!-- INCORRECT -->\n<mds-card style=\"width: 300px; height: 200px;\">\n  ...\n</mds-card>\n\n<!-- CORRECT: size the card from a parent container or CSS custom properties -->\n<div class=\"w-[300px]\">\n  <mds-card>\n    ...\n  </mds-card>\n</div>\n```\n"
      },
      "props": [
        {
          "name": "disableAutoGrid",
          "type": "boolean",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean",
            "references": {}
          },
          "mutable": false,
          "attr": "disable-auto-grid",
          "reflectToAttr": true,
          "docs": "Disables the automatic responsive behavior based on container queries",
          "docsTags": [
            {
              "name": "default",
              "text": "false"
            }
          ],
          "default": "false",
          "values": [
            {
              "type": "boolean"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-card-background",
          "annotation": "prop",
          "docs": "Sets the background color of the card and of its regions (`mds-card-header`, `mds-card-media`, `mds-card-content`, `mds-card-footer`)",
          "visibility": "public"
        },
        {
          "name": "--mds-card-color",
          "annotation": "prop",
          "docs": "Sets the text color of the card, inherited by its regions, `--magma-text-default` by default: set it together with `--mds-card-background`, so the text keeps reading on the surface",
          "visibility": "public"
        },
        {
          "name": "--mds-card-gap",
          "annotation": "prop",
          "docs": "Sets the space between the regions of the card, `--magma-rhythm-title-content` by default; the footer keeps at least `--magma-rhythm-content-actions` from the region before it",
          "visibility": "public"
        },
        {
          "name": "--mds-card-padding",
          "annotation": "prop",
          "docs": "Sets the inset of the card, shared by its regions, `--magma-rhythm-inset` by default; the media region reaches out of it to the edges it touches",
          "visibility": "public"
        }
      ],
      "slots": [
        {
          "name": "content",
          "docs": "Add `HTML elements` or `components`, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        },
        {
          "name": "footer",
          "docs": "Add `HTML elements` or `components`, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        },
        {
          "name": "header",
          "docs": "Add `HTML elements` or `components`, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        },
        {
          "name": "media",
          "docs": "Add `HTML elements` or `components`Add `HTML elements` or `components`, it is **recommended** to use `mds-img` element or other component to represent media contents, used for images or videos, it's responsive behaviour based on container queries is handled with `auto-grid` enabled"
        }
      ],
      "parts": [
        {
          "name": "layout",
          "docs": "The layout element that wraps the slotted content"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "layout-card--docs"
    }
  ]
}
