{
  "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-header/mds-card-header.tsx",
      "encapsulation": "shadow",
      "tag": "mds-card-header",
      "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": "parent",
          "text": "mds-card"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-card-header>` web component is the header region of a [`<mds-card>`](../mds-card/AGENTS.md), grouping the card's title, supporting text, and optional inline actions. It carries no styling of its own beyond layout: its job is to occupy the parent card's `header` region and arrange its content alongside any action controls.\n\n#### Semantic Behavior\n\n- **Compound child only**: `<mds-card-header>` must be placed as a direct child of `<mds-card>`; it is not used standalone, and a card expects at most one header alongside its sibling card regions (`mds-card-media`, `mds-card-content`, `mds-card-footer`), not mixed with arbitrary elements.\n- **Self-slotting into the parent**: It automatically lands in the card's `header` region without the author setting any `slot` attribute, and its presence is factored into the card's responsive layout.\n- **Action slot presence**: The dedicated actions wrapper is shown only while a direct child assigned to the `action` slot exists, also when it is added after the first render, so a header without actions produces no empty action container.\n- **No role/ARIA of its own**: It exposes no implicit role, state, or events; it is a passive layout grouping.\n\n#### Properties & Visual Configurations\n\n`<mds-card-header>` has no configurable properties - it is a pure layout child driven entirely by its two slots:\n\n- **Default (unnamed) slot**: Holds the primary header content (title text, HTML, or components such as a heading element).\n- **`action` slot**: Holds inline action controls, rendered in a separate region next to the header content; `mds-button` is the recommended element here. Provide content to this slot only when the header needs actions, since the wrapper is shown only while children are present.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-card-header>` 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 Title in the Default Slot\n\nThe most common use: pass heading text (or a heading element) into the default slot to set the card's title. The header arranges it in the card's top region automatically.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Dettagli account</mds-text>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Contenuto principale della card.</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Header with Inline Action\n\nPlace one or more `<mds-button>` elements in the `action` slot when the header needs an inline control. The actions wrapper is only rendered when at least one element is assigned to this slot - omit the slot entirely when no actions are needed.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Impostazioni notifiche</mds-text>\n    <mds-button\n      slot=\"action\"\n      icon=\"mi/baseline/edit\"\n      aria-label=\"Modifica impostazioni\"\n      variant=\"primary\"\n      tone=\"text\"\n    ></mds-button>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Gestisci le preferenze di notifica.</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Header with Multiple Actions\n\nAdd multiple elements to the `action` slot when several inline controls are needed. They are rendered in the single actions region next to the header content.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Documento di progetto</mds-text>\n    <mds-button\n      slot=\"action\"\n      label=\"Modifica\"\n      icon=\"mi/baseline/edit\"\n      variant=\"primary\"\n      tone=\"outline\"\n    ></mds-button>\n    <mds-button\n      slot=\"action\"\n      icon=\"mi/baseline/delete\"\n      aria-label=\"Elimina documento\"\n      variant=\"error\"\n      tone=\"text\"\n    ></mds-button>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Specifiche tecniche rev. 3.</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Header with Supporting Text\n\nPass additional descriptive text below the title by wrapping title and text in one element in the default slot. The header lays its default-slot children out in a row, spread apart (`justify-content: space-between`), so two loose elements would sit side by side.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <div class=\"flex flex-col\">\n      <mds-text typography=\"h5\">Report mensile</mds-text>\n      <mds-text typography=\"caption\">Aggiornato il 1 giugno 2026</mds-text>\n    </div>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Riepilogo delle attivita del mese.</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n\n#### Full Card Composition\n\n`<mds-card-header>` is designed to compose with the other card sub-parts. Each sub-part self-slots into its region; the card infers which regions are present and adjusts its layout accordingly.\n\n```html\n<mds-card>\n  <mds-card-media>\n    <mds-img src=\"/images/copertina.jpg\" alt=\"Copertina articolo\"></mds-img>\n  </mds-card-media>\n  <mds-card-header>\n    <mds-text typography=\"h4\">Novita dal team</mds-text>\n    <mds-button\n      slot=\"action\"\n      icon=\"mi/baseline/share\"\n      aria-label=\"Condividi\"\n      variant=\"primary\"\n      tone=\"text\"\n    ></mds-button>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Aggiornamenti sul rilascio di Magma 3.0.</mds-text>\n  </mds-card-content>\n  <mds-card-footer>\n    <mds-button label=\"Leggi di piu\" variant=\"primary\" tone=\"strong\"></mds-button>\n  </mds-card-footer>\n</mds-card>\n```\n\n#### Header Without a Title - Using the Action Slot Alone\n\nWhen the card header exists only to host action controls and carries no title text, leave the default slot empty and place the controls in the `action` slot. The component renders just the actions container.\n\n```html\n<mds-card>\n  <mds-card-header>\n    <mds-button\n      slot=\"action\"\n      icon=\"mi/baseline/more-vert\"\n      aria-label=\"Altre opzioni\"\n      variant=\"dark\"\n      tone=\"text\"\n    ></mds-button>\n  </mds-card-header>\n  <mds-card-content>\n    <mds-text>Scheda con solo azione nell'intestazione.</mds-text>\n  </mds-card-content>\n</mds-card>\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-card-header>`. 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-card-header>` Outside `<mds-card>`\n\n`<mds-card-header>` is a compound child; it must be a direct child of `<mds-card>`. Using it standalone renders nothing useful - the host card's slot plumbing drives all layout.\n\n```html\n<!-- INCORRECT -->\n<mds-card-header>\n  <mds-text typography=\"h5\">Titolo</mds-text>\n</mds-card-header>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Titolo</mds-text>\n  </mds-card-header>\n</mds-card>\n```\n\n#### Do Not Set `slot=\"header\"` Manually on `<mds-card-header>`\n\nThe component sets its own `slot=\"header\"` in its `render()` host binding. Adding the attribute again on the element in the light DOM is redundant: the component writes it itself, overwriting any other value when it renders.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-header slot=\"header\">\n    <mds-text typography=\"h5\">Titolo</mds-text>\n  </mds-card-header>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Titolo</mds-text>\n  </mds-card-header>\n</mds-card>\n```\n\n#### Do Not Put Action Controls in the Default Slot\n\n`<mds-button>` and other action controls belong in the `action` named slot, not in the default slot. Placing them in the default slot breaks the layout - no actions wrapper groups them, and the header spreads every default-slot child along the row (`justify-content: space-between`), so the controls land wherever the number of siblings puts them rather than together at the far end.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Rapporto annuale</mds-text>\n    <mds-button label=\"Modifica\" variant=\"primary\"></mds-button>\n  </mds-card-header>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Rapporto annuale</mds-text>\n    <mds-button slot=\"action\" label=\"Modifica\" variant=\"primary\" tone=\"outline\"></mds-button>\n  </mds-card-header>\n</mds-card>\n```\n\n#### Do Not Use a Raw `<div>` as the Card Header Instead of `<mds-card-header>`\n\nUsing a plain `<div slot=\"header\">` bypasses the component's conditional action wrapper, its shadow layout, and the parent's compound-child detection. The component also ensures correct alignment and spacing between title and actions.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <div slot=\"header\">\n    <h5>Riepilogo ordini</h5>\n    <button>Modifica</button>\n  </div>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Riepilogo ordini</mds-text>\n    <mds-button slot=\"action\" label=\"Modifica\" variant=\"primary\" tone=\"outline\"></mds-button>\n  </mds-card-header>\n</mds-card>\n```\n\n#### Do Not Invent a Custom `slot` Name on Children of `<mds-card-header>`\n\n`<mds-card-header>` exposes exactly two slots: the default (unnamed) slot and `action`. Assigning any other slot name silently discards the element.\n\n```html\n<!-- INCORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Dashboard</mds-text>\n    <mds-button slot=\"actions\" label=\"Aggiungi\" variant=\"primary\"></mds-button>\n  </mds-card-header>\n</mds-card>\n\n<!-- CORRECT -->\n<mds-card>\n  <mds-card-header>\n    <mds-text typography=\"h5\">Dashboard</mds-text>\n    <mds-button slot=\"action\" label=\"Aggiungi\" variant=\"primary\" tone=\"strong\"></mds-button>\n  </mds-card-header>\n</mds-card>\n```\n"
      },
      "props": [],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [],
      "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."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "layout-card-header--docs"
    }
  ]
}
