{
  "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-header-bar/mds-header-bar.tsx",
      "encapsulation": "shadow",
      "tag": "mds-header-bar",
      "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": "actions - Selects the element which wraps `nav` and `hamburger` parts"
        },
        {
          "name": "part",
          "text": "content - The row that holds the default slot, on the left, and the `actions`"
        },
        {
          "name": "part",
          "text": "hamburger - Selects the `hamburger` menu action element"
        },
        {
          "name": "part",
          "text": "nav - Selects the `nav` element that contains the horizontal menu"
        },
        {
          "name": "slot",
          "text": "- Put contents, like logo and a small description shown on the left of the component. Add `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "slot",
          "text": "nav - Put the actions shown when the component is on desktop mode. Add `HTML elements` or `components`, it is **recommended** to use `mds-button` element."
        },
        {
          "name": "parent",
          "text": "mds-header"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-header-bar>` web component is the top bar of a Magma application layout: it holds the product branding on the left and the primary navigation actions on the right, collapsing those actions into a hamburger menu on smaller viewports. It is a structural compound element, typically nested inside an `<mds-header>`, with no native HTML primitive equivalent.\n\n#### Semantic Behavior\n\n- **Branding region**: The default (unnamed) slot is the logo/branding area on the left; place text, HTML, or components such as a logo with a short description here.\n- **Navigation region**: The `nav` named slot holds the horizontal desktop actions, wrapped in a real `<nav>` element; `mds-button` elements are the recommended children.\n- **Conditional nav rendering**: The `<nav>` is shown only when `nav` is not `'none'` and a `slot=\"nav\"` child is present, also when it is added after the first render, so an empty header collapses cleanly.\n- **Hamburger trigger**: When `menu` is not `'none'` the component renders a menu button that opens the menu on click, icon-only and named in the page language (the `lang` of `<html>`) (\"Open menu\").\n- **Open event**: Clicking the hamburger emits the bubbling `mdsHeaderBarOpen` event and opens the drawer on the surrounding `mds-header`.\n- **Imperative open control**: The public `setOpened(isOpened = true)` method opens or closes the drawer of the surrounding `mds-header`, as the hamburger does; outside an `mds-header` it does nothing.\n- **The frame of the page**: The content of the bar stops at the width of the page, `--magma-width-page` (1280px), centred, with the gutter of the page, `--magma-width-page-gutter` (`600`), outside it: it starts where the content of an element with the `page-frame` utility starts, at every width (`widths/page` of the design language). A theme that moves the two tokens moves the bar and the page together.\n\n#### Properties & Visual Configurations\n\nThe two props are both responsive visibility switches sharing the value set `'all' | 'desktop' | 'mobile' | 'none'`, where the value names the breakpoint(s) at which the region is shown (`'none'` hides it entirely, `'all'` always shows it).\n\n- **`menu`** controls when the hamburger button appears. It defaults to `'mobile'`, so the collapsed menu surfaces only on small screens; set it to `'all'` to always expose the menu trigger or `'none'` to suppress it.\n- **`nav`** controls when the inline horizontal navigation is shown. It defaults to `'desktop'`, the typical complement to `menu`: links sit inline on wide viewports and fold into the hamburger on narrow ones.\n\nInside `mds-header` both are written by the header from its own `menu` and `nav` when it loads, replacing the values set on the bar: set them on `mds-header` there.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-header-bar>` 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#### Standard Header Bar with Logo and Navigation\n\nThe canonical form. Place branding content in the default slot (left side) and `<mds-button>` elements in the `nav` slot (right side). With the defaults (`menu=\"mobile\"` and `nav=\"desktop\"`) the nav is visible on desktop and the hamburger appears only on mobile.\n\n```html\n<mds-header-bar>\n  <div class=\"flex gap-200 items-center\">\n    <mds-img src=\"./logo.svg\" alt=\"Maggioli\"></mds-img>\n    <mds-text typography=\"h6\">Portale Enti</mds-text>\n  </div>\n  <mds-button slot=\"nav\" variant=\"dark\" tone=\"outline\">Accedi</mds-button>\n  <mds-button slot=\"nav\" variant=\"primary\" tone=\"strong\">Registrati</mds-button>\n</mds-header-bar>\n```\n\n#### Nested Inside `mds-header`\n\n`<mds-header-bar>` is a structural sub-component of [`mds-header`](../mds-header/AGENTS.md). Place it inside `<mds-header>` so that the hamburger click is wired to the drawer automatically; the component calls `mds-header.setOpened(true)` on its nearest `mds-header` ancestor.\n\n```html\n<mds-header>\n  <mds-header-bar>\n    <mds-text typography=\"h6\">Gestione Pratiche</mds-text>\n    <mds-button slot=\"nav\" variant=\"dark\" tone=\"text\" icon=\"mi/baseline/person\">Account</mds-button>\n    <mds-button slot=\"nav\" variant=\"primary\" tone=\"strong\">Nuovo documento</mds-button>\n  </mds-header-bar>\n  <!-- drawer and other header regions go here -->\n</mds-header>\n```\n\n#### On the Frame of the Page\n\nThe content of the bar stands on the frame of the page. Put the `page-frame` utility on the content of the page, one element, and its edges meet the edges of the content of the bar at every width; write no width or gutter of your own.\n\n```html\n<mds-header>\n  <mds-header-bar>\n    <mds-text typography=\"h6\">Gestione Pratiche</mds-text>\n  </mds-header-bar>\n</mds-header>\n<main class=\"page-frame\">\n  <h1 class=\"text-title-page\">Pratiche</h1>\n</main>\n```\n\n#### Controlling Hamburger Visibility\n\nUse the `menu` prop to decide when the hamburger button is shown (inside `mds-header`, set `menu` and `nav` on `mds-header`: it overwrites the bar's values when it loads). The default `mobile` is correct for most apps. Use `all` when you always want a drawer-style menu regardless of viewport, or `none` to remove the hamburger entirely (e.g. a public marketing bar with no drawer).\n\n```html\n<!-- Always show the hamburger (single-column layout, any viewport) -->\n<mds-header-bar menu=\"all\">\n  <mds-text typography=\"h6\">Area Personale</mds-text>\n</mds-header-bar>\n\n<!-- No hamburger at all (branding-only bar) -->\n<mds-header-bar menu=\"none\">\n  <mds-img src=\"./logo.svg\" alt=\"Maggioli\"></mds-img>\n</mds-header-bar>\n```\n\n#### Controlling Inline Navigation Visibility\n\nUse the `nav` prop symmetrically with `menu`. The default `desktop` shows the nav slot only on wide viewports. Set `nav=\"all\"` to always show inline links, `nav=\"mobile\"` to show them only on small screens, or `nav=\"none\"` to suppress the nav region entirely.\n\n```html\n<!-- Always show inline nav (no responsive collapsing) -->\n<mds-header-bar menu=\"none\" nav=\"all\">\n  <mds-img src=\"./logo.svg\" alt=\"Maggioli\"></mds-img>\n  <mds-button slot=\"nav\" variant=\"dark\" tone=\"text\">Chi siamo</mds-button>\n  <mds-button slot=\"nav\" variant=\"dark\" tone=\"text\">Servizi</mds-button>\n  <mds-button slot=\"nav\" variant=\"primary\" tone=\"strong\">Contatti</mds-button>\n</mds-header-bar>\n```\n\n#### Listening for the Hamburger Open Event\n\nListen to `mdsHeaderBarOpen` (bubbles) to react when the user taps the hamburger - for example to track analytics or to open a custom side panel not managed by `mds-header`.\n\n```html\n<mds-header-bar id=\"main-bar\">\n  <mds-text typography=\"h6\">Applicazione</mds-text>\n</mds-header-bar>\n\n<script>\n  document.getElementById('main-bar').addEventListener('mdsHeaderBarOpen', () => {\n    console.log('menu aperto');\n  });\n</script>\n```\n\n#### Programmatic Open via `setOpened`\n\nTo open or close the drawer from external code - for instance after route navigation in a single-page app - call `setOpened` on the surrounding `mds-header`, or on the bar, which hands it to its `mds-header`.\n\n```html\n<mds-header id=\"main-header\">\n  <mds-header-bar>\n    <mds-text typography=\"h6\">Dashboard</mds-text>\n  </mds-header-bar>\n  <div slot=\"menu\">\n    <mds-button label=\"Pratiche\" variant=\"dark\" tone=\"text\"></mds-button>\n  </div>\n</mds-header>\n\n<script>\n  // Close the drawer after the user selects a menu item\n  const header = document.getElementById('main-header');\n  header.setOpened(false);\n</script>\n```\n\n#### Styling the Hamburger Icon Color\n\n`mds-header-bar` has no public CSS custom property. Inside an `mds-header`, the hamburger takes the header's public `--mds-header-color`: set it on the header. To color the hamburger of a bar used on its own, set `fill` on its documented `hamburger` part. Use a semantic color role wrapped with `rgb(var(--magma-<role>))` so dark-mode works automatically.\n\n```css\nmds-header {\n  --mds-header-color: rgb(var(--magma-accent-fg));\n}\n\nmds-header-bar::part(hamburger) {\n  fill: rgb(var(--magma-accent-fg));\n}\n```\n\n#### Styling via Shadow Parts\n\nThe four documented shadow parts (`content`, `actions`, `nav`, `hamburger`) let you adjust layout without piercing the shadow DOM. Target only these documented parts.\n\n```css\n/* Increase the gap between the nav buttons and the hamburger */\nmds-header-bar::part(actions) {\n  gap: calc(var(--spacing) * 600);\n}\n\n/* Visually highlight the hamburger button in a branded theme */\nmds-header-bar::part(hamburger) {\n  border-radius: var(--magma-radius-md);\n  background-color: rgb(var(--magma-accent-surface));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-header-bar>`. 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-header-bar` Standalone Outside `mds-header`\n\n`<mds-header-bar>` is a structural sub-component of [`mds-header`](../mds-header/AGENTS.md). Used alone, the hamburger click has no `mds-header` ancestor to call `setOpened` on, so the drawer never opens. Always place it inside `<mds-header>` unless you have fully replaced drawer management with `mdsHeaderBarOpen` listeners.\n\n```html\n<!-- INCORRECT -->\n<mds-header-bar>\n  <mds-text typography=\"h6\">Portale</mds-text>\n</mds-header-bar>\n\n<!-- CORRECT -->\n<mds-header>\n  <mds-header-bar>\n    <mds-text typography=\"h6\">Portale</mds-text>\n  </mds-header-bar>\n</mds-header>\n```\n\n#### Do Not Put Navigation Links in the Default Slot\n\nThe default slot is the branding region (left side). Navigation actions must go in the `nav` named slot so the component can apply responsive visibility rules and wrap them in the `<nav>` element for landmark semantics.\n\n```html\n<!-- INCORRECT -->\n<mds-header-bar>\n  <mds-img src=\"./logo.svg\" alt=\"Maggioli\"></mds-img>\n  <mds-button variant=\"dark\" tone=\"text\">Servizi</mds-button>\n  <mds-button variant=\"primary\" tone=\"strong\">Accedi</mds-button>\n</mds-header-bar>\n\n<!-- CORRECT -->\n<mds-header-bar>\n  <mds-img src=\"./logo.svg\" alt=\"Maggioli\"></mds-img>\n  <mds-button slot=\"nav\" variant=\"dark\" tone=\"text\">Servizi</mds-button>\n  <mds-button slot=\"nav\" variant=\"primary\" tone=\"strong\">Accedi</mds-button>\n</mds-header-bar>\n```\n\n#### Do Not Set Both `menu` and `nav` to `none` Without a Replacement\n\nSetting both to `none` hides all interactive regions and leaves a branding-only bar with no way to navigate, which is rarely the intended result. If the design truly needs a pure branding strip, be explicit about it and confirm it is intentional; otherwise keep at least one region visible.\n\n```html\n<!-- INCORRECT (navigation is invisible and unreachable) -->\n<mds-header-bar menu=\"none\" nav=\"none\">\n  <mds-img src=\"./logo.svg\" alt=\"Maggioli\"></mds-img>\n  <mds-button slot=\"nav\" variant=\"dark\" tone=\"text\">Servizi</mds-button>\n</mds-header-bar>\n\n<!-- CORRECT (at least one region stays visible) -->\n<mds-header-bar menu=\"none\" nav=\"all\">\n  <mds-img src=\"./logo.svg\" alt=\"Maggioli\"></mds-img>\n  <mds-button slot=\"nav\" variant=\"dark\" tone=\"text\">Servizi</mds-button>\n</mds-header-bar>\n```\n\n#### Do Not Pierce Shadow DOM to Style the Hamburger or Nav\n\n`mds-header-bar` has no public CSS custom property: the documented customization hooks are the shadow parts `content`, `actions`, `nav`, `hamburger`, and, inside an `mds-header`, the header's public `--mds-header-color`, which colors the hamburger too. Targeting undocumented internal classes couples your code to implementation details that can change at any minor release.\n\n```css\n/* INCORRECT */\nmds-header-bar >>> .menu {\n  fill: red;\n}\nmds-header-bar::part(icon) {\n  fill: blue;\n}\n\n/* CORRECT */\nmds-header-bar::part(hamburger) {\n  background-color: rgb(var(--magma-wash-base));\n  fill: rgb(var(--magma-accent-fg));\n}\n```\n\n#### Do Not Listen to `click` on the Hamburger Instead of `mdsHeaderBarOpen`\n\nA `click` listener on the host fires for every click inside the bar (logo, nav buttons), not only on the hamburger. Use the documented `mdsHeaderBarOpen` event, which bubbles and fires only when the hamburger is pressed.\n\n```html\n<!-- INCORRECT -->\n<mds-header-bar id=\"bar\">...</mds-header-bar>\n<script>\n  document.getElementById('bar').addEventListener('click', handleMenu);\n</script>\n\n<!-- CORRECT -->\n<mds-header-bar id=\"bar\">...</mds-header-bar>\n<script>\n  document.getElementById('bar').addEventListener('mdsHeaderBarOpen', handleMenu);\n</script>\n```\n\n#### Do Not Set `menu` or `nav` to an Undocumented String Value\n\nThe accepted values for both props are `'all' | 'desktop' | 'mobile' | 'none'`. Strings outside that set are not validated: any value other than `none` shows the region on every viewport, as `all` does, producing unexpected layout.\n\n```html\n<!-- INCORRECT -->\n<mds-header-bar menu=\"always\" nav=\"never\">...</mds-header-bar>\n<mds-header-bar menu=\"true\" nav=\"false\">...</mds-header-bar>\n\n<!-- CORRECT -->\n<mds-header-bar menu=\"all\" nav=\"none\">...</mds-header-bar>\n```\n"
      },
      "props": [
        {
          "name": "menu",
          "type": "\"all\" | \"desktop\" | \"mobile\" | \"none\"",
          "complexType": {
            "original": "HeaderBarMenuType",
            "resolved": "\"all\" | \"desktop\" | \"mobile\" | \"none\"",
            "references": {
              "HeaderBarMenuType": {
                "location": "import",
                "path": "@type/header-bar",
                "id": "src/type/header-bar.ts::HeaderBarMenuType",
                "referenceLocation": "HeaderBarMenuType"
              }
            }
          },
          "mutable": false,
          "attr": "menu",
          "reflectToAttr": true,
          "docs": "Sets the visibility type of the hamburger menu",
          "docsTags": [
            {
              "name": "default",
              "text": "'mobile'"
            }
          ],
          "default": "'mobile'",
          "values": [
            {
              "value": "all",
              "type": "string"
            },
            {
              "value": "desktop",
              "type": "string"
            },
            {
              "value": "mobile",
              "type": "string"
            },
            {
              "value": "none",
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "nav",
          "type": "\"all\" | \"desktop\" | \"mobile\" | \"none\"",
          "complexType": {
            "original": "HeaderBarNavType",
            "resolved": "\"all\" | \"desktop\" | \"mobile\" | \"none\"",
            "references": {
              "HeaderBarNavType": {
                "location": "import",
                "path": "@type/header-bar",
                "id": "src/type/header-bar.ts::HeaderBarNavType",
                "referenceLocation": "HeaderBarNavType"
              }
            }
          },
          "mutable": false,
          "attr": "nav",
          "reflectToAttr": true,
          "docs": "Sets the visibility type of the navigation menu",
          "docsTags": [
            {
              "name": "default",
              "text": "'desktop'"
            }
          ],
          "default": "'desktop'",
          "values": [
            {
              "value": "all",
              "type": "string"
            },
            {
              "value": "desktop",
              "type": "string"
            },
            {
              "value": "mobile",
              "type": "string"
            },
            {
              "value": "none",
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [
        {
          "name": "setOpened",
          "returns": {
            "type": "Promise<void>",
            "docs": ""
          },
          "complexType": {
            "signature": "(isOpened?: boolean) => Promise<void>",
            "parameters": [
              {
                "name": "isOpened",
                "type": "boolean",
                "docs": "whether the menu should be opened"
              }
            ],
            "references": {
              "Promise": {
                "location": "global",
                "id": "global::Promise"
              }
            },
            "return": "Promise<void>"
          },
          "signature": "setOpened(isOpened?: boolean) => Promise<void>",
          "parameters": [
            {
              "name": "isOpened",
              "type": "boolean",
              "docs": "whether the menu should be opened"
            }
          ],
          "docs": "Opens or closes the menu of the surrounding `mds-header`, as the hamburger does.",
          "docsTags": [
            {
              "name": "param",
              "text": "isOpened whether the menu should be opened"
            }
          ]
        }
      ],
      "events": [
        {
          "event": "mdsHeaderBarOpen",
          "detail": "void",
          "bubbles": true,
          "complexType": {
            "original": "void",
            "resolved": "void",
            "references": {}
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component is opened",
          "docsTags": []
        }
      ],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-header-bar-hamburger-color",
          "annotation": "prop",
          "docs": "The color of the hamburger icon used in the header bar; inside an `mds-header` it defaults to the `--mds-header-icon-color` or `--mds-header-color` set on it.",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Put contents, like logo and a small description shown on the left of the component. Add `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "nav",
          "docs": "Put the actions shown when the component is on desktop mode. Add `HTML elements` or `components`, it is **recommended** to use `mds-button` element."
        }
      ],
      "parts": [
        {
          "name": "actions",
          "docs": "Selects the element which wraps `nav` and `hamburger` parts"
        },
        {
          "name": "content",
          "docs": "The row that holds the default slot, on the left, and the `actions`"
        },
        {
          "name": "hamburger",
          "docs": "Selects the `hamburger` menu action element"
        },
        {
          "name": "nav",
          "docs": "Selects the `nav` element that contains the horizontal menu"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-button"
      ],
      "dependencyGraph": {
        "mds-header-bar": [
          "mds-button"
        ],
        "mds-button": [
          "mds-icon",
          "mds-spinner",
          "mds-text"
        ]
      },
      "storybook": "ui-header-header-bar--docs"
    }
  ]
}
