{
  "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-details/mds-details.tsx",
      "encapsulation": "shadow",
      "tag": "mds-details",
      "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": "slot",
          "text": "action - Add `HTML elements` or `components`, it is **recommended** to use `mds-button` element."
        },
        {
          "name": "slot",
          "text": "icon - Insert an icon image, it can be `HTML elements` or `components`, it is **recommended** to add `mds-icon` element."
        },
        {
          "name": "slot",
          "text": "title - Add a `text string`, `HTML elements` or `components`, it is **recommended** to use `mds-text` element."
        },
        {
          "name": "part",
          "text": "header - The header of the component"
        },
        {
          "name": "part",
          "text": "title - The title of the component"
        },
        {
          "name": "part",
          "text": "content - The content wrapper of the default and `action` slots"
        },
        {
          "name": "category",
          "text": "structure"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-details>` web component is the disclosure widget of the Magma Design System: a collapsible block with a clickable header that shows or hides its content on demand. It is the styled, accessible equivalent of the native HTML `<details>`/`<summary>` pair, structured into dedicated `title`, `icon`, `action` and content regions.\n\n#### Semantic Behavior\n\n- **Open/closed state**: The `opened` prop expands or collapses the content region with a transition.\n- **Header activation**: Clicking the header or the leading icon toggles the open state, and the header is keyboard-activatable with Enter and Space.\n- **Closed content**: While closed, the content is hidden from the tab order and from assistive technologies, not only from the eye; it shows for the whole opening and closing animation.\n- **Change event**: Each user toggle emits `mdsDetailsChange` carrying the new boolean open state; changing `opened` from code emits nothing.\n- **Icon slot presence**: The leading icon area auto-hides when no `icon` slot is provided.\n- **Default slot vs. named slots**: The default (unnamed) slot is the collapsible body. The `title` slot is the always-visible header label, `icon` is the optional leading glyph, and `action` is a footer region inside the expandable content meant for action controls.\n\n#### Properties & Visual Configurations\n\nThis component intentionally exposes a single behavioral prop. Visual surface is driven through slots and the documented shadow parts (`header`, `title`, `content`) rather than through variant/tone props: the component has no public CSS custom property.\n\n- **`opened`** sets the expanded state. Set it to pre-expand the block on first render, or change it to open / close the block from code. A user toggle writes it back too (property and reflected attribute), so it always holds the current state.\n\n#### Other behavioral props\n\n- The **`title`** slot is recommended to hold an `mds-text`; the **`icon`** slot an `mds-icon`; and the **`action`** slot an `mds-button` for the primary action tied to the disclosed content.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-details>` 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 Disclosure Block\n\nThe minimal form: a `title` slot for the always-visible header and a default slot for the collapsible body. Use `mds-text` in both slots so typography tokens are applied consistently.\n\n```html\n<mds-details>\n  <mds-text typography=\"h6\" slot=\"title\">Descrizione del progetto</mds-text>\n  <mds-text typography=\"detail\">\n    Questa sezione raccoglie le informazioni principali relative all'ambito e agli obiettivi del\n    progetto.\n  </mds-text>\n</mds-details>\n```\n\n#### Pre-expanded State via `opened`\n\nPass the `opened` boolean attribute to expand the block on first render. User toggles update it, and emit `mdsDetailsChange`.\n\n```html\n<mds-details opened>\n  <mds-text typography=\"h6\" slot=\"title\">Note operative</mds-text>\n  <mds-text typography=\"paragraph\">\n    Le note operative sono visibili fin dal caricamento della pagina per garantire una lettura\n    immediata.\n  </mds-text>\n</mds-details>\n```\n\n#### Leading Icon via the `icon` Slot\n\nPlace an `mds-icon` in the `icon` slot to add a leading glyph that also acts as a toggle. The icon area auto-hides when the slot is empty, so leaving it out does not leave an empty gap.\n\n```html\n<mds-details>\n  <mds-icon slot=\"icon\" name=\"mi/baseline/info\"></mds-icon>\n  <mds-text typography=\"h6\" slot=\"title\">Requisiti di accesso</mds-text>\n  <mds-text typography=\"detail\">\n    Per accedere al servizio e necessario disporre di credenziali SPID di livello 2 o superiore.\n  </mds-text>\n</mds-details>\n```\n\n#### Action Button via the `action` Slot\n\nThe `action` slot sits at the bottom of the expandable content region. Use `mds-button` (recommended) for the primary action tied to the disclosed content.\n\n```html\n<mds-details>\n  <mds-icon slot=\"icon\" name=\"mi/baseline/check-circle\"></mds-icon>\n  <mds-text typography=\"h6\" slot=\"title\">Modulistica richiesta</mds-text>\n  <mds-text typography=\"detail\">\n    Scarica e compila il modulo A3 prima di procedere con la richiesta.\n  </mds-text>\n  <mds-button slot=\"action\" size=\"sm\" variant=\"primary\" tone=\"outline\" label=\"Scarica il modulo\"></mds-button>\n</mds-details>\n```\n\n#### Listening to Toggle Events\n\nSubscribe to `mdsDetailsChange` to react to open/close transitions. The event detail carries the new boolean state. Do not listen for native `click` on the host.\n\n```html\n<mds-details id=\"faq-1\">\n  <mds-text typography=\"h6\" slot=\"title\">Come posso rinnovare il contratto?</mds-text>\n  <mds-text typography=\"detail\">\n    Il rinnovo puo essere effettuato online dall'area personale almeno 30 giorni prima della\n    scadenza.\n  </mds-text>\n</mds-details>\n\n<script>\n  document.getElementById('faq-1').addEventListener('mdsDetailsChange', (event) => {\n    console.log('Stato apertura:', event.detail); // true | false\n  });\n</script>\n```\n\n#### Programmatic Control\n\nAssign the `opened` property to drive the disclosure from code - for example to expand all items at once or to implement accordion logic manually. User toggles write `opened` back, so it always holds the current state: `opened = true` opens a block the user had closed.\n\n```html\n<mds-details id=\"step-1\">\n  <mds-text typography=\"h6\" slot=\"title\">Passo 1: Verifica dei dati</mds-text>\n  <mds-text typography=\"detail\">\n    Controlla che tutti i dati anagrafici siano corretti prima di procedere.\n  </mds-text>\n</mds-details>\n\n<mds-button id=\"expand-btn\" label=\"Espandi tutti\" variant=\"primary\" tone=\"text\"></mds-button>\n\n<script>\n  document.getElementById('expand-btn').addEventListener('click', () => {\n    document.querySelectorAll('mds-details').forEach((el) => {\n      el.opened = true;\n    });\n  });\n</script>\n```\n\n#### CSS Customization\n\n`mds-details` has no public CSS custom property: style it with its props, its parts and the semantic roles. The icon colors and the open/close transition follow the theme. Set colors on the documented parts with the semantic color roles via `rgb(var(--magma-<role>))` so dark mode, named themes and high contrast keep working.\n\n```css\n.custom-faq mds-details::part(header) {\n  background: rgb(var(--magma-surface-muted));\n}\n```\n\n#### Styling Shadow Parts\n\nUse the documented shadow `::part()` names: `header`, `title`, and `content`. Do not target undocumented internals.\n\n```css\n/* Increase header padding for a spacious FAQ layout */\n.faq-section mds-details::part(header) {\n  padding: calc(var(--spacing) * 300) 0;\n}\n\n/* Give the title extra weight */\n.faq-section mds-details::part(title) {\n  font-weight: 600;\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-details>`. 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 the Title Text in the Default Slot\n\nThe default slot is the collapsible body. Text placed there is hidden until the user expands the block, so it cannot serve as the visible header. Use the `title` slot for the header label.\n\n```html\n<!-- INCORRECT -->\n<mds-details>\n  Requisiti di accesso\n</mds-details>\n\n<!-- CORRECT -->\n<mds-details>\n  <mds-text typography=\"h6\" slot=\"title\">Requisiti di accesso</mds-text>\n</mds-details>\n```\n\n#### Do Not Replace `<mds-details>` with a Raw `<details>` Element\n\nThe native `<details>` lacks Magma theming, the leading icon slot, the `action` slot, smooth CSS grid transitions, preference support (reduced-motion, high-contrast), and the `mdsDetailsChange` event contract. Always use `<mds-details>` inside a Magma application.\n\n```html\n<!-- INCORRECT -->\n<details>\n  <summary>Modulistica richiesta</summary>\n  <p>Scarica il modulo A3 prima di procedere.</p>\n</details>\n\n<!-- CORRECT -->\n<mds-details>\n  <mds-text typography=\"h6\" slot=\"title\">Modulistica richiesta</mds-text>\n  <mds-text typography=\"detail\">Scarica il modulo A3 prima di procedere.</mds-text>\n</mds-details>\n```\n\n#### Do Not Set `opened=\"false\"` to Collapse the Component\n\n`opened` is a boolean attribute. The component reads the string `\"false\"` as `false` and drops the attribute when it renders, but until then the attribute is in the DOM and attribute selectors (`mds-details[opened]`) see the block as open. Remove the attribute entirely to collapse it, or set the property to `undefined` / `false` in JavaScript.\n\n```html\n<!-- INCORRECT -->\n<mds-details opened=\"false\">\n  <mds-text typography=\"h6\" slot=\"title\">Note operative</mds-text>\n</mds-details>\n\n<!-- CORRECT -->\n<mds-details>\n  <mds-text typography=\"h6\" slot=\"title\">Note operative</mds-text>\n</mds-details>\n```\n\n#### Do Not Inline an `<mds-icon>` in the `title` Slot to Fake a Leading Glyph\n\nThe `icon` slot is the dedicated region for the leading glyph; it also participates in the toggle click area. Putting `mds-icon` inside the `title` slot bypasses this layout: the icon area stays hidden and the glyph sits in the title text.\n\n```html\n<!-- INCORRECT -->\n<mds-details>\n  <span slot=\"title\">\n    <mds-icon name=\"mi/baseline/info\"></mds-icon>\n    Informazioni sul servizio\n  </span>\n</mds-details>\n\n<!-- CORRECT -->\n<mds-details>\n  <mds-icon slot=\"icon\" name=\"mi/baseline/info\"></mds-icon>\n  <mds-text typography=\"h6\" slot=\"title\">Informazioni sul servizio</mds-text>\n</mds-details>\n```\n\n#### Do Not Listen for Native `click` to Detect Toggle\n\nClicking the header triggers `mdsDetailsChange` with the new state. Listening for raw `click` on the host or its shadow parts is fragile - it fires on every sub-element click, may not bubble out of shadow DOM as expected, and gives you no reliable open/closed state.\n\n```html\n<!-- INCORRECT -->\n<mds-details id=\"det\">\n  <mds-text typography=\"h6\" slot=\"title\">Dettaglio</mds-text>\n</mds-details>\n\n<script>\n  // Do not do this - fires on any click, no open/closed state\n  document.getElementById('det').addEventListener('click', () => {\n    console.log('click rilevato');\n  });\n</script>\n\n<!-- CORRECT -->\n<script>\n  document.getElementById('det').addEventListener('mdsDetailsChange', (e) => {\n    console.log('Aperto:', e.detail); // true | false\n  });\n</script>\n```\n\n#### Do Not Pierce the Shadow DOM to Style Internals\n\n`mds-details` has no public CSS custom property: the only supported customization surface is the three documented shadow parts (`header`, `title`, `content`). Targeting undocumented class names or using `>>>` couples your code to the internal implementation and will break on minor releases.\n\n```css\n/* INCORRECT */\nmds-details >>> .helper-icon {\n  fill: red;\n}\nmds-details >>> .header {\n  background: yellow;\n}\n\n/* CORRECT */\nmds-details::part(header) {\n  background: rgb(var(--magma-surface-muted));\n}\n```\n"
      },
      "props": [
        {
          "name": "opened",
          "type": "boolean",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean",
            "references": {}
          },
          "mutable": true,
          "attr": "opened",
          "reflectToAttr": true,
          "docs": "Specifies if the component is opened",
          "docsTags": [
            {
              "name": "default",
              "text": "false"
            }
          ],
          "default": "false",
          "values": [
            {
              "type": "boolean"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [
        {
          "event": "mdsDetailsChange",
          "detail": "boolean",
          "bubbles": true,
          "complexType": {
            "original": "boolean",
            "resolved": "boolean",
            "references": {}
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component is opened",
          "docsTags": []
        }
      ],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-details-duration",
          "annotation": "prop",
          "docs": "Sets the transition duration for details component",
          "visibility": "internal"
        },
        {
          "name": "--mds-details-helper-icon-color",
          "annotation": "prop",
          "docs": "Sets the color of the helper icon in the details component",
          "visibility": "internal"
        },
        {
          "name": "--mds-details-icon-color",
          "annotation": "prop",
          "docs": "Sets the color of the details icon",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "action",
          "docs": "Add `HTML elements` or `components`, it is **recommended** to use `mds-button` element."
        },
        {
          "name": "icon",
          "docs": "Insert an icon image, it can be `HTML elements` or `components`, it is **recommended** to add `mds-icon` element."
        },
        {
          "name": "title",
          "docs": "Add a `text string`, `HTML elements` or `components`, it is **recommended** to use `mds-text` element."
        }
      ],
      "parts": [
        {
          "name": "content",
          "docs": "The content wrapper of the default and `action` slots"
        },
        {
          "name": "header",
          "docs": "The header of the component"
        },
        {
          "name": "title",
          "docs": "The title of the component"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "ui-details--docs"
    }
  ]
}
