{
  "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-item/mds-accordion-item.tsx",
      "encapsulation": "shadow",
      "tag": "mds-accordion-item",
      "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 contents like `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "part",
          "text": "content - the content wrapper of the `default` slot"
        },
        {
          "name": "part",
          "text": "icon - The arrow icon of the component"
        },
        {
          "name": "part",
          "text": "label - The text label of the component"
        },
        {
          "name": "parent",
          "text": "mds-accordion"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-accordion-item>` web component is a single collapsible panel of the Magma Design System, designed to be slotted inside its parent [`<mds-accordion>`](../mds-accordion/AGENTS.md). It renders a header button paired with an expandable content region; the parent controls which items are open.\n\n#### Semantic Behavior\n\n- **Compound child only**: Must be placed as a direct default-slot child of `<mds-accordion>`; it is not used standalone, and the parent's slot should hold only `mds-accordion-item` elements, not mixed child types.\n- **Parent-driven selection**: Clicking the header requests a toggle, but the authoritative open/closed state is resolved by the parent - in single mode opening one item closes its siblings, while in `multiple` mode each item toggles independently.\n- **Emitted events**: `mdsAccordionItemSelect` on open, `mdsAccordionItemUnselect` on close, and `mdsAccordionItemChange` on any toggle, each carrying `{ id, selected }`.\n- **Default slot**: Holds the collapsible body content (text, HTML, or components).\n\n#### Properties & Visual Configurations\n\n- **`label`** sets the always-visible header text shown whether the item is open or closed.\n- **`selected`** controls whether the panel is expanded; leave it to the parent to manage in coordinated accordions, or set it initially to have a panel start open.\n- **`typography`** picks the title style applied to the header label, defaulting to `h5`. An item is a part of the page, and the title of a part is styled as `h6` (`titles/part` of the design language): write `typography=\"h6\"` until the default moves with the next major (#1218). `action` gives a compact, control-like header. The value is a style only: the label is a `<span>` inside the `<button>` that opens the item, whatever its style.\n- **`tag`** puts the title in the outline of the page, at the level of its place: `tag=\"h3\"` under a section titled `h2`. The heading wraps the button, as the Accordion pattern of the WAI-ARIA Authoring Practices does, so whoever navigates by headings reaches each item. Left out, the item is not a heading: the component cannot know its place, and the level of its style (`h6`) would skip the levels in between.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-accordion-item>` 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>` elements as direct children of [`<mds-accordion>`](../mds-accordion/AGENTS.md). Provide `label` for the header text and put the body content in the default slot.\n\n```html\n<mds-accordion>\n  <mds-accordion-item label=\"Cos'e' Magma?\">\n    <mds-text>Magma e' il design system di Maggioli, basato su web components.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Come si installa?\">\n    <mds-text>Importa il loader e chiama defineCustomElements() nell'entry point.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"E' compatibile con React?\">\n    <mds-text>Si', usa il pacchetto @maggioli-design-system/magma-react.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Panel Open by Default\n\nSet `selected` on the item you want pre-expanded. The parent does not resolve conflicts on load, so in single mode set it on one item only, unless `multiple` is also set on the parent.\n\n```html\n<mds-accordion>\n  <mds-accordion-item label=\"Introduzione\" selected>\n    <mds-text>Questa sezione e' aperta per impostazione predefinita.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Prerequisiti\">\n    <mds-text>Node.js 18+ e un package manager npm o pnpm.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Multiple Panels Open Simultaneously\n\nAdd `multiple` to `<mds-accordion>` so the user can expand more than one panel at once. Individual items do not change - the parent mode governs the behaviour.\n\n```html\n<mds-accordion multiple>\n  <mds-accordion-item label=\"Configurazione di base\">\n    <mds-text>Imposta i token di colore e il tema nell'entry point dell'applicazione.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Configurazione avanzata\" selected>\n    <mds-text>Personalizza i CSS custom properties per adattare il tema al brand.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Integrazione CI/CD\" selected>\n    <mds-text>Configura il job di build per generare documentation.json e readme.md.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Non-closable Accordion\n\nSet the parent `disable-close` attribute to prevent the user from collapsing an open panel. An open item then stays open until another item is clicked; with `multiple`, the last open item cannot be closed. Because `disableClose` defaults to `false`, just add the boolean attribute to enable mandatory selection.\n\n```html\n<mds-accordion disable-close>\n  <mds-accordion-item label=\"Passo 1 - Installazione\" selected>\n    <mds-text>Esegui npm install @maggioli-design-system/magma per aggiungere il pacchetto.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Passo 2 - Configurazione\">\n    <mds-text>Importa defineCustomElements e registra i componenti nell'app.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### The Title of an Item Is a Part\n\nAn item is a part of the page, 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 only; `tag` gives the level of the title in the outline, one below the title of the section that holds the accordion (`h3` under an `h2`). Use `action` for a compact, control-like header.\n\n```html\n<mds-text typography=\"section\" tag=\"h2\">Domande frequenti</mds-text>\n<mds-accordion>\n  <mds-accordion-item label=\"Come gestisco gli aggiornamenti?\" typography=\"h6\" tag=\"h3\">\n    <mds-text>Ogni release e' documentata nel changelog con note di migrazione.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Posso personalizzare i colori?\" typography=\"h6\" tag=\"h3\">\n    <mds-text>Si', tramite i CSS custom properties esposti da ogni componente.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\nThe heading wraps the button that opens the item, as the Accordion pattern of the WAI-ARIA Authoring Practices does: a screen reader lists the questions among the headings of the page, under Domande frequenti. Left out, `tag` leaves the item a button only, out of the outline; never write the level of the style (`tag=\"h6\"` under an `h2`), which skips the levels in between.\n\n#### Rich Slot Content\n\nThe default slot accepts any HTML or components - not just text. Use it for structured content such as lists, forms, or nested components.\n\n```html\n<mds-accordion>\n  <mds-accordion-item label=\"Dettagli del progetto\">\n    <mds-text typography=\"h6\">Tecnologie utilizzate</mds-text>\n    <mds-list>\n      <mds-list-item>StencilJS</mds-list-item>\n      <mds-list-item>TypeScript</mds-list-item>\n      <mds-list-item>Storybook</mds-list-item>\n    </mds-list>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Contatti del team\">\n    <mds-text>Scrivi a design-system@maggioli.it per supporto tecnico.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Listening to Item Events\n\n`mdsAccordionItemChange` fires on every toggle; `mdsAccordionItemSelect` fires only on open; `mdsAccordionItemUnselect` fires only on close. Use `mdsAccordionItemChange` when you only need to react to any state change, or the specific event when you need to handle open and close differently. The parent overwrites each item's `id` with `item-<index>` on load, and that is the `detail.id`: do not select items by an `id` of your own.\n\n```html\n<mds-accordion id=\"faq\">\n  <mds-accordion-item label=\"Domanda frequente 1\">\n    <mds-text>Risposta alla prima domanda.</mds-text>\n  </mds-accordion-item>\n  <mds-accordion-item label=\"Domanda frequente 2\">\n    <mds-text>Risposta alla seconda domanda.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n\n<script>\n  document.querySelector('#faq').addEventListener('mdsAccordionItemChange', (e) => {\n    console.log('item changed:', e.detail.id, 'selected:', e.detail.selected);\n  });\n\n  document.querySelector('#faq mds-accordion-item').addEventListener('mdsAccordionItemSelect', (e) => {\n    console.log('faq-1 opened');\n  });\n</script>\n```\n\n#### Styling Customization\n\nStyle each item only through its public `--mds-accordion-item-*` CSS custom properties. Setting the public `--mds-accordion-*` properties on the parent `<mds-accordion>` propagates to all children via the cascade variables the items consume.\n\n```css\n/* Customize all items via the parent */\nmds-accordion {\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/* Or target a single item directly */\n.sidebar mds-accordion-item {\n  --mds-accordion-item-color: rgb(var(--magma-text-default));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-accordion-item>`. 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-accordion-item` Outside `mds-accordion`\n\nThe item relies on the parent to give it an `id` when it has none, manage sibling state, and emit coordinated change events. Placed standalone it still toggles, but nothing coordinates it, no `mdsAccordionChange` is emitted, and its events carry an empty `id`.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion-item label=\"Sezione autonoma\">\n  <mds-text>Contenuto senza accordeon genitore.</mds-text>\n</mds-accordion-item>\n\n<!-- CORRECT -->\n<mds-accordion>\n  <mds-accordion-item label=\"Sezione autonoma\">\n    <mds-text>Contenuto all'interno del genitore corretto.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Do Not Wrap `mds-accordion-item` in Extra Elements\n\nItems are direct children of `mds-accordion` by contract (see [`agents/conventions.md`](../../../../agents/conventions.md)). The parent still finds wrapped items, since it queries every descendant, but the borders of an open item depend on its position among its siblings (`:first-child` / `:last-child`), which a wrapper changes.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion>\n  <div class=\"group\">\n    <mds-accordion-item label=\"FAQ 1\">\n      <mds-text>Risposta alla prima domanda.</mds-text>\n    </mds-accordion-item>\n  </div>\n</mds-accordion>\n\n<!-- CORRECT -->\n<mds-accordion>\n  <mds-accordion-item label=\"FAQ 1\">\n    <mds-text>Risposta alla prima domanda.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Do Not Set `label` via the Default Slot\n\n`label` is a required prop that renders the header button text, which is also the button's accessible name; the default slot holds only the collapsible body content. Putting header text in the slot places it inside the body region and leaves the required `label` prop empty, breaking both layout and accessibility.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion>\n  <mds-accordion-item>\n    Dettagli dell'ordine\n  </mds-accordion-item>\n</mds-accordion>\n\n<!-- CORRECT -->\n<mds-accordion>\n  <mds-accordion-item label=\"Dettagli dell'ordine\">\n    <mds-text>Numero ordine: 12345, data: 01/06/2026.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n\n#### Do Not Override Open/Close State by Piercing the Shadow DOM\n\n`selected` is reflected as a host attribute and is writable via JavaScript. Targeting the internal `.content` div or `.icon` element via `>>>` or undocumented class names to show/hide content manually bypasses the coordinated state machine and breaks sibling sync. The documented `content` part styles the panel body; it does not open it. Setting `selected` from JavaScript emits no event and does not close the siblings: in single mode, unset the open item yourself.\n\n```css\n/* INCORRECT */\nmds-accordion-item >>> .content {\n  grid-template-rows: 1fr;\n}\n```\n\n```js\n/* CORRECT - toggle via the reflected property */\nconst item = document.querySelector('mds-accordion-item#shipping'); // the id you gave the item\nitem.selected = true;\n```\n\n#### Do Not Listen for Native `click` or `change` Events Instead of the Documented `mds*` Events\n\nA native `click` bubbles up from anywhere inside the item, body content included, and carries no state; there is no native `change` event on this component. The documented events `mdsAccordionItemChange`, `mdsAccordionItemSelect`, and `mdsAccordionItemUnselect` are the designed surface.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion id=\"faq\">\n  <mds-accordion-item label=\"Domanda 1\">\n    <mds-text>Risposta 1.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n\n<script>\n  document.querySelector('#faq mds-accordion-item').addEventListener('click', () => {\n    console.log('clicked - also fires for clicks inside the body');\n  });\n</script>\n\n<!-- CORRECT -->\n<script>\n  document.querySelector('#faq mds-accordion-item').addEventListener('mdsAccordionItemChange', (e) => {\n    console.log('stato:', e.detail.selected);\n  });\n</script>\n```\n\n#### Do Not Use `<details>`/`<summary>` Inside the Slot as a Second Disclosure Layer\n\nThe item already is a styled disclosure widget. Nesting a native `<details>` inside the slot creates redundant expand/collapse semantics, duplicates keyboard interactions, and produces conflicting visual states.\n\n```html\n<!-- INCORRECT -->\n<mds-accordion>\n  <mds-accordion-item label=\"Configurazione\">\n    <details>\n      <summary>Mostra dettagli</summary>\n      <p>Parametri avanzati di configurazione.</p>\n    </details>\n  </mds-accordion-item>\n</mds-accordion>\n\n<!-- CORRECT - put content directly in the slot -->\n<mds-accordion>\n  <mds-accordion-item label=\"Configurazione\">\n    <mds-text typography=\"h6\">Parametri avanzati</mds-text>\n    <mds-text>Descrizione dei parametri di configurazione avanzata.</mds-text>\n  </mds-accordion-item>\n</mds-accordion>\n```\n"
      },
      "props": [
        {
          "name": "label",
          "type": "string",
          "complexType": {
            "original": "string",
            "resolved": "string",
            "references": {}
          },
          "mutable": false,
          "attr": "label",
          "reflectToAttr": false,
          "docs": "Specifies the title shown when the component is closed or selected",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            }
          ],
          "optional": false,
          "required": true,
          "getter": false,
          "setter": false
        },
        {
          "name": "selected",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": true,
          "attr": "selected",
          "reflectToAttr": true,
          "docs": "Specifies if the component item is selected or not",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "tag",
          "type": "\"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | undefined",
          "complexType": {
            "original": "TypographyHeadingTagType",
            "resolved": "\"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | undefined",
            "references": {
              "TypographyHeadingTagType": {
                "location": "import",
                "path": "@type/text",
                "id": "src/type/text.ts::TypographyHeadingTagType",
                "referenceLocation": "TypographyHeadingTagType"
              }
            }
          },
          "mutable": false,
          "attr": "tag",
          "reflectToAttr": false,
          "docs": "Specifies the heading level of the title, the level of its place in the outline of the\npage (`h3` under a section titled `h2`): the heading wraps the button that opens the item,\nas the Accordion pattern of the WAI-ARIA Authoring Practices does. Left out, the item is\nnot a heading: only the page knows its place, and the level of the style would skip the\nlevels in between",
          "docsTags": [],
          "values": [
            {
              "value": "h1",
              "type": "string"
            },
            {
              "value": "h2",
              "type": "string"
            },
            {
              "value": "h3",
              "type": "string"
            },
            {
              "value": "h4",
              "type": "string"
            },
            {
              "value": "h5",
              "type": "string"
            },
            {
              "value": "h6",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "typography",
          "type": "\"action\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | undefined",
          "complexType": {
            "original": "TypographyTitleType",
            "resolved": "\"action\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | undefined",
            "references": {
              "TypographyTitleType": {
                "location": "import",
                "path": "@type/typography",
                "id": "src/type/typography.ts::TypographyTitleType",
                "referenceLocation": "TypographyTitleType"
              }
            }
          },
          "mutable": false,
          "attr": "typography",
          "reflectToAttr": false,
          "docs": "Specifies the typography of the title. An item is a part of the page, whose title is\nstyled as `h6` (`titles/part`, #1189): write `h6` until the default moves with the next\nmajor (#1218). It is the style only: the level of the title in the outline is `tag`",
          "docsTags": [
            {
              "name": "default",
              "text": "'h5'"
            }
          ],
          "default": "'h5'",
          "values": [
            {
              "value": "action",
              "type": "string"
            },
            {
              "value": "h1",
              "type": "string"
            },
            {
              "value": "h2",
              "type": "string"
            },
            {
              "value": "h3",
              "type": "string"
            },
            {
              "value": "h4",
              "type": "string"
            },
            {
              "value": "h5",
              "type": "string"
            },
            {
              "value": "h6",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [
        {
          "event": "mdsAccordionItemChange",
          "detail": "MdsAccordionItemEventDetail",
          "bubbles": true,
          "complexType": {
            "original": "MdsAccordionItemEventDetail",
            "resolved": "MdsAccordionItemEventDetail",
            "references": {
              "MdsAccordionItemEventDetail": {
                "location": "import",
                "path": "./meta/event-detail",
                "id": "src/components/mds-accordion-item/meta/event-detail.ts::MdsAccordionItemEventDetail",
                "referenceLocation": "MdsAccordionItemEventDetail"
              }
            }
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component attribute selected is changed",
          "docsTags": []
        },
        {
          "event": "mdsAccordionItemSelect",
          "detail": "MdsAccordionItemEventDetail",
          "bubbles": true,
          "complexType": {
            "original": "MdsAccordionItemEventDetail",
            "resolved": "MdsAccordionItemEventDetail",
            "references": {
              "MdsAccordionItemEventDetail": {
                "location": "import",
                "path": "./meta/event-detail",
                "id": "src/components/mds-accordion-item/meta/event-detail.ts::MdsAccordionItemEventDetail",
                "referenceLocation": "MdsAccordionItemEventDetail"
              }
            }
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component is selected",
          "docsTags": []
        },
        {
          "event": "mdsAccordionItemUnselect",
          "detail": "MdsAccordionItemEventDetail",
          "bubbles": true,
          "complexType": {
            "original": "MdsAccordionItemEventDetail",
            "resolved": "MdsAccordionItemEventDetail",
            "references": {
              "MdsAccordionItemEventDetail": {
                "location": "import",
                "path": "./meta/event-detail",
                "id": "src/components/mds-accordion-item/meta/event-detail.ts::MdsAccordionItemEventDetail",
                "referenceLocation": "MdsAccordionItemEventDetail"
              }
            }
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component is unselected",
          "docsTags": []
        }
      ],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-accordion-item-border-color",
          "annotation": "prop",
          "docs": "Sets the border-color of the component",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-item-border-width",
          "annotation": "prop",
          "docs": "Sets the border-width of the separators of the component",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-item-color",
          "annotation": "prop",
          "docs": "Sets the text-color of the component",
          "visibility": "public"
        },
        {
          "name": "--mds-accordion-item-description-color",
          "annotation": "prop",
          "docs": "Sets the color of the always visible title description",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-item-duration",
          "annotation": "prop",
          "docs": "Sets the transition duration of the close/open animation of the component",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-item-padding-selected",
          "annotation": "prop",
          "docs": "Sets the vertical padding of the component when it's selected",
          "visibility": "internal"
        },
        {
          "name": "--mds-accordion-item-padding-unselected",
          "annotation": "prop",
          "docs": "Sets the vertical padding of the component when it's unselected",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add contents like `text string`, `HTML elements` or `components` to this slot."
        }
      ],
      "parts": [
        {
          "name": "content",
          "docs": "the content wrapper of the `default` slot"
        },
        {
          "name": "icon",
          "docs": "The arrow icon of the component"
        },
        {
          "name": "label",
          "docs": "The text label of the component"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-text"
      ],
      "dependencyGraph": {
        "mds-accordion-item": [
          "mds-text"
        ]
      },
      "storybook": "ui-accordion-accordion-item--docs"
    }
  ]
}
