{
  "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-accordion/mds-accordion.tsx",
      "encapsulation": "shadow",
      "tag": "mds-accordion",
      "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 `mds-accordion-item` element/s."
        },
        {
          "name": "category",
          "text": "structure"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-accordion>` web component is the compound container of the Magma Design System that groups and orchestrates a set of collapsible `<mds-accordion-item>` panels. It acts as the coordination layer that decides which children are selected.\n\n#### Semantic Behavior\n\n- **Compound parent/child**: The default slot accepts only `<mds-accordion-item>` elements.\n- **Single vs. multiple selection**: By default opening one item collapses the others. With `multiple` set, any number of children may stay open at once and selection state is reported as a comma-separated list of indices.\n- **Mandatory selection**: When `disable-close` is set, the user cannot collapse the currently open item by clicking it again - one panel always remains open.\n- **Emitted event**: `mdsAccordionChange` once for every change of the open items, opening and closing alike, carrying the live `children` NodeList and the `selected` index/indices as a string (empty when none is open). A click that `disable-close` turns down changes nothing and emits nothing.\n\n#### Properties & Visual Configurations\n\nThis component has no shared `variant` / `tone` / `size` props; its two booleans control selection semantics rather than appearance.\n\n#### Other behavioral props\n\n- **`multiple`** switches the group from accordion behavior (one panel at a time) to independent toggles, allowing several panels open simultaneously.\n- **`disableClose`** prevents the active panel from being dismissed; set it to force at least one panel to stay expanded at all times.\n\nPer-panel presentation - the visible `label`, the title style `typography`, the level `tag` of the title in the outline of the page, and the slotted body content - is configured on each `<mds-accordion-item>` child, not on the accordion itself.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-accordion>` 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 Accordion\n\nThe canonical form. Place one or more [`mds-accordion-item`](../mds-accordion-item/AGENTS.md) elements as direct children. Each item requires a `label` for its always-visible header.\n\n```html\n<mds-accordion>\n  <mds-accordion-item label=\"Informazioni generali\">\n    <mds-text>Contenuto della prima sezione.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Requisiti tecnici\">\n    <mds-text>Contenuto della seconda sezione.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Contatti\">\n    <mds-text>Contenuto della terza sezione.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Pre-selected Item on Load\n\nSet the `selected` attribute on a child to have that panel start open. Only one item should be pre-selected in single-selection mode (the default).\n\n```html\n<mds-accordion>\n  <mds-accordion-item label=\"Panoramica\" selected>\n    <mds-text>Questa sezione e' aperta per impostazione predefinita.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Dettagli\">\n    <mds-text>Questa sezione e' chiusa inizialmente.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Multiple Selection Mode\n\nSet `multiple` to allow any number of panels to be open at the same time. The `mdsAccordionChange` event then reports a comma-separated list of open indices.\n\n```html\n<mds-accordion multiple>\n  <mds-accordion-item label=\"Documentazione\" selected>\n    <mds-text>Scarica la guida utente in formato PDF.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Video tutorial\" selected>\n    <mds-text>Guarda i video di formazione nel portale.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"FAQ\">\n    <mds-text>Consulta le domande frequenti.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Mandatory Selection (Non-closable)\n\nSet `disable-close` to prevent the open panel from being collapsed. The currently expanded item stays open even when the user clicks its header again - exactly one panel is always visible.\n\n```html\n<mds-accordion disable-close>\n  <mds-accordion-item label=\"Passaggio 1 - Dati anagrafici\" selected>\n    <mds-text>Inserisci nome, cognome e codice fiscale.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Passaggio 2 - Residenza\">\n    <mds-text>Inserisci indirizzo e comune di residenza.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Passaggio 3 - Riepilogo\">\n    <mds-text>Verifica i dati inseriti prima di inviare.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### A Title Above, Parts Inside\n\nThe accordion stands under the title of its section, written by its role; each item is a part, whose title is styled as `h6` (`titles/part`): write `typography=\"h6\"` until the default moves from `h5` with the next major (#1218). `typography` is the style of an item; its `tag` is the level in the outline, one below the title of the section (`h3` under an `h2`), and the heading wraps the button that opens the item, as the Accordion pattern of the WAI-ARIA Authoring Practices does.\n\n```html\n<mds-text typography=\"section\" tag=\"h2\">Documenti richiesti</mds-text>\n<mds-accordion>\n  <mds-accordion-item label=\"Documento di identita'\" typography=\"h6\" tag=\"h3\">\n    <mds-text>Carta d'identita' o passaporto in corso di validita'.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Codice fiscale\" typography=\"h6\" tag=\"h3\">\n    <mds-text>La tessera sanitaria o il certificato di attribuzione.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Listening to the Change Event\n\nListen for `mdsAccordionChange` to react when the active panel changes. The event detail carries `children` (the full NodeList) and `selected` (a string index or comma-separated indices when `multiple` is set).\n\n```html\n<mds-accordion id=\"faq-accordion\">\n  <mds-accordion-item label=\"Cos'e' Magma?\">\n    <mds-text>Magma e' il design system di Maggioli.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Come si installa?\">\n    <mds-text>Segui le istruzioni nel file README del pacchetto.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n\n<script>\n  document.getElementById('faq-accordion').addEventListener('mdsAccordionChange', (event) => {\n    console.log('Pannello aperto:', event.detail.selected);\n  });\n</script>\n```\n\n#### Rich Slotted Content in Items\n\nThe default slot of each `mds-accordion-item` accepts text, HTML elements, and other Magma components - use this to build complex content panels.\n\n```html\n<mds-accordion>\n  <mds-accordion-item label=\"Dettagli del documento\">\n    <mds-text typography=\"label\">Nome file</mds-text>\n    <mds-text>Relazione_annuale_2024.pdf</mds-text>\n    <mds-hr></mds-hr>\n    <mds-text typography=\"label\">Dimensione</mds-text>\n    <mds-text>2,4 MB</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Azioni disponibili\">\n    <mds-button label=\"Scarica\" icon=\"mi/baseline/download\" variant=\"primary\"></mds-button>\n    <mds-button label=\"Condividi\" icon=\"mi/baseline/share\" variant=\"primary\" tone=\"outline\"></mds-button>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Styling Customization\n\nStyle the accordion only through its public `--mds-accordion-*` CSS custom properties. The properties cascade into all child `mds-accordion-item` elements from the host.\n\n```css\n.custom-faq mds-accordion {\n  --mds-accordion-color: rgb(var(--magma-text-default));\n  --mds-accordion-padding-selected: calc(var(--spacing) * 600) 0 calc(var(--spacing) * 800) 0;\n  --mds-accordion-padding-unselected: calc(var(--spacing) * 400) 0;\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-accordion>`. 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 Place Non-Item Children Directly in the Accordion Slot\n\nThe default slot of `<mds-accordion>` is designed exclusively for `<mds-accordion-item>` elements. Placing raw HTML or other components there bypasses the parent's selection coordination and breaks the compound component communication.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion>\n  <div>\n    <h3>Sezione uno</h3>\n    <p>Contenuto della sezione.</p>\n  </div>\n</mds-accordion>\n\n<!-- CORRECT -->\n<mds-accordion>\n  <mds-accordion-item label=\"Sezione uno\">\n    <mds-text>Contenuto della sezione.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Do Not Use `mds-accordion-item` Outside `mds-accordion`\n\n`<mds-accordion-item>` is a compound child and relies on the parent to give it an `id` when it has none and to manage selection state. Used standalone it has no coordinator and its `mdsAccordionItemSelect` / `mdsAccordionItemUnselect` events go unanswered.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion-item label=\"Domanda frequente\">\n  <mds-text>Risposta alla domanda.</mds-text>\n</mds-accordion-item>\n\n<!-- CORRECT -->\n<mds-accordion>\n  <mds-accordion-item label=\"Domanda frequente\">\n    <mds-text>Risposta alla domanda.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Do Not Listen to Native `click` or `toggle` Instead of `mdsAccordionChange`\n\nA native `click` bubbles up from anywhere inside the accordion, panel content included, and carries no selection state; there is no native `toggle` event on this component. Listen for `mdsAccordionChange`, whose `detail.selected` holds the open index/indices.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion id=\"my-accordion\">\n  <mds-accordion-item label=\"Sezione A\">\n    <mds-text>Contenuto A.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n<script>\n  document.getElementById('my-accordion').addEventListener('click', (e) => {\n    // fires on any click, panel content included, and says nothing about the selection\n    console.log('clicked');\n  });\n</script>\n\n<!-- CORRECT -->\n<mds-accordion id=\"my-accordion\">\n  <mds-accordion-item label=\"Sezione A\">\n    <mds-text>Contenuto A.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n<script>\n  document.getElementById('my-accordion').addEventListener('mdsAccordionChange', (e) => {\n    console.log('Selezione corrente:', e.detail.selected);\n  });\n</script>\n```\n\n#### Do Not Mix `mds-accordion-item` and `mds-accordion-timer-item`\n\n[`mds-accordion-timer`](../mds-accordion-timer/AGENTS.md) and its child [`mds-accordion-timer-item`](../mds-accordion-timer-item/AGENTS.md) are a separate compound pair. Slotting timer items into a plain accordion (or vice versa) breaks internal event wiring because each parent only listens for its own child's events.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion>\n  <mds-accordion-timer-item description=\"Avanzamento automatico\">\n    <mds-text>Contenuto con timer.</mds-text>\n  </mds-accordion-timer-item>\n</mds-accordion>\n\n<!-- CORRECT - use mds-accordion-timer with mds-accordion-timer-item -->\n<mds-accordion-timer>\n  <mds-accordion-timer-item description=\"Avanzamento automatico\">\n    <mds-text>Contenuto con timer.</mds-text>\n  </mds-accordion-timer-item>\n</mds-accordion-timer>\n```\n\n#### Do Not Pierce Shadow DOM to Style Internals\n\nThe only supported customization surface is the public `--mds-accordion-*` CSS custom properties and the documented `::part()` names on `mds-accordion-item` (`content`, `icon`, `label`). Targeting undocumented internals via `>>>` or deep class selectors couples code to the Shadow DOM implementation and breaks on minor releases.\n\n```css\n/* INCORRECT */\nmds-accordion >>> .action {\n  font-weight: bold;\n}\nmds-accordion-item::part(spinner) {\n  display: none;\n}\n\n/* CORRECT */\nmds-accordion {\n  --mds-accordion-color: rgb(var(--magma-text-default));\n}\nmds-accordion-item::part(label) {\n  font-style: italic;\n}\n```\n"
      },
      "props": [
        {
          "name": "disableClose",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "disable-close",
          "reflectToAttr": false,
          "docs": "Prevents the user from closing the currently open item, forcing at least one panel to stay expanded",
          "docsTags": [
            {
              "name": "default",
              "text": "false"
            }
          ],
          "default": "false",
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "multiple",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "multiple",
          "reflectToAttr": false,
          "docs": "Choose if multiple siblings can be selected simultaneously",
          "docsTags": [
            {
              "name": "default",
              "text": "false"
            }
          ],
          "default": "false",
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [
        {
          "event": "mdsAccordionChange",
          "detail": "MdsAccordionEventDetail",
          "bubbles": true,
          "complexType": {
            "original": "MdsAccordionEventDetail",
            "resolved": "MdsAccordionEventDetail",
            "references": {
              "MdsAccordionEventDetail": {
                "location": "import",
                "path": "./meta/event-detail",
                "id": "src/components/mds-accordion/meta/event-detail.ts::MdsAccordionEventDetail",
                "referenceLocation": "MdsAccordionEventDetail"
              }
            }
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component attribute selected is changed",
          "docsTags": []
        }
      ],
      "listeners": [
        {
          "event": "mdsAccordionItemSelect",
          "capture": false,
          "passive": false
        },
        {
          "event": "mdsAccordionItemUnselect",
          "capture": false,
          "passive": false
        }
      ],
      "styles": [
        {
          "name": "--mds-accordion-border-color",
          "annotation": "prop",
          "docs": "Sets the border-color of the component children mds-accordion-item",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-border-width",
          "annotation": "prop",
          "docs": "Sets the border-width of the separators of the component children mds-accordion-item",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-color",
          "annotation": "prop",
          "docs": "Sets the text-color of the component children mds-accordion-item",
          "visibility": "public"
        },
        {
          "name": "--mds-accordion-description-color",
          "annotation": "prop",
          "docs": "Sets the color of the always visible title description",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-duration",
          "annotation": "prop",
          "docs": "Sets the transition duration of the close/open animation of the component children mds-accordion-item",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-padding-selected",
          "annotation": "prop",
          "docs": "Sets the vertical padding of the component children mds-accordion-item when it's selected",
          "visibility": "public"
        },
        {
          "name": "--mds-accordion-padding-unselected",
          "annotation": "prop",
          "docs": "Sets the vertical padding of the component children mds-accordion-item when it's unselected",
          "visibility": "public"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add `mds-accordion-item` element/s."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "ui-accordion--docs"
    }
  ]
}
