{
  "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-button-group/mds-button-group.tsx",
      "encapsulation": "shadow",
      "tag": "mds-button-group",
      "docs": "",
      "docsTags": [
        {
          "name": "slot",
          "text": "- Add `mds-button` or `mds-button-dropdown` elements to this slot."
        },
        {
          "name": "category",
          "text": "actions"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-button-group>` web component is a layout container of the Magma Design System that clusters related `<mds-button>` controls into a single, evenly-spaced horizontal group such as toolbars, action bars, or segmented sets of actions. It is a presentation-only wrapper with no props, events, or state - its sole job is to arrange its slotted children consistently.\n\n#### Semantic Behavior\n\n- **Default slot is content**: Whatever buttons (or button-like controls) you place inside are projected in source order. The group joins its `<mds-button>` / `<mds-button-dropdown>` members: it flattens their inner corners and sets them 2px apart, so only the outer corners of the cluster stay rounded.\n- **Inline layout**: The group shrinks to fit its content with consistent spacing and stays inline with surrounding elements; on its own it never takes the full row width.\n- **Width in a stretched row**: A row that stretches the group, as `actions/stacked` does under `--magma-container-actions` (380px) in `<mds-card-footer>`, `<mds-banner>`, `<mds-status-bar>` or a row of your own (`align-self: stretch`, a `width`, a `flex-basis`), gets the cluster across the whole row, as every other labelled action of it: each labelled member keeps its own width plus the same share of the free width, its label in the middle, so a long label is never cut for a short one; an `<mds-button-dropdown>` member gives its share to its primary action, and an icon-only member keeps its size.\n- **No own semantics**: It exposes no role, ARIA attributes, form association, focus management, or keyboard handling of its own - accessibility and interaction live entirely in the slotted children. It is purely a visual grouping primitive.\n\n#### Properties & Visual Configurations\n\nThis component has no configurable properties. Visual outcome is determined entirely by the slotted children - typically a set of `<mds-button>` elements sharing a common `variant` / `tone` (see the shared ladder in [`agents/variants.md`](../../../../agents/variants.md)) so the group reads as a cohesive cluster of actions.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-button-group>` 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#### Toolbar of Icon-Only Actions\n\nThe primary use case. Group icon-only `<mds-button>` elements that act on the same target - a text selection, a table row, or an editor surface. Each button must carry an explicit `aria-label` because no visible label is present.\n\n```html\n<mds-button-group>\n  <mds-button icon=\"mi/baseline/format-bold\" aria-label=\"Grassetto\" variant=\"dark\" tone=\"text\"></mds-button>\n  <mds-button icon=\"mi/baseline/format-italic\" aria-label=\"Corsivo\" variant=\"dark\" tone=\"text\"></mds-button>\n  <mds-button icon=\"mi/baseline/format-underlined\" aria-label=\"Sottolineato\" variant=\"dark\" tone=\"text\"></mds-button>\n</mds-button-group>\n```\n\n#### Segmented Set of Labelled Actions\n\nUse labelled buttons when the actions benefit from visible text - for example a primary / secondary / destructive trio at the bottom of a form section.\n\n```html\n<mds-button-group>\n  <mds-button label=\"Salva\" variant=\"primary\" tone=\"strong\"></mds-button>\n  <mds-button label=\"Annulla\" variant=\"dark\" tone=\"outline\"></mds-button>\n</mds-button-group>\n```\n\n#### Mixed Emphasis Within a Group\n\nPair a high-emphasis primary button with lower-emphasis supporting actions. Keep the same `variant` family and vary only the `tone` so the group reads as a cohesive cluster, not a random set of buttons.\n\n```html\n<mds-button-group>\n  <mds-button label=\"Pubblica\" variant=\"primary\" tone=\"strong\"></mds-button>\n  <mds-button label=\"Salva come bozza\" variant=\"primary\" tone=\"outline\"></mds-button>\n  <mds-button label=\"Elimina\" variant=\"error\" tone=\"text\"></mds-button>\n</mds-button-group>\n```\n\n#### Inside a Toolbar or Action Bar\n\n`<mds-button-group>` is `inline-flex` by default, so multiple groups sit naturally beside other inline controls in a toolbar without extra CSS.\n\n```html\n<div class=\"toolbar\">\n  <mds-button-group>\n    <mds-button icon=\"mi/baseline/undo\" aria-label=\"Annulla\" variant=\"dark\" tone=\"text\"></mds-button>\n    <mds-button icon=\"mi/baseline/redo\" aria-label=\"Ripristina\" variant=\"dark\" tone=\"text\"></mds-button>\n  </mds-button-group>\n\n  <mds-button-group>\n    <mds-button icon=\"mi/baseline/format-bold\" aria-label=\"Grassetto\" variant=\"dark\" tone=\"text\"></mds-button>\n    <mds-button icon=\"mi/baseline/format-italic\" aria-label=\"Corsivo\" variant=\"dark\" tone=\"text\"></mds-button>\n    <mds-button icon=\"mi/baseline/format-underlined\" aria-label=\"Sottolineato\" variant=\"dark\" tone=\"text\"></mds-button>\n  </mds-button-group>\n</div>\n```\n\n#### Including a `<mds-button-dropdown>` in the Group\n\nThe default slot accepts any `<mds-button>` or `<mds-button-dropdown>` sibling component. Place the dropdown last or first depending on visual priority.\n\n```html\n<mds-button-group>\n  <mds-button label=\"Esporta CSV\" variant=\"primary\" tone=\"weak\"></mds-button>\n  <mds-button-dropdown label=\"Altre opzioni\" variant=\"primary\" tone=\"weak\">\n    <mds-button variant=\"dark\" tone=\"text\" label=\"Esporta PDF\"></mds-button>\n    <mds-button variant=\"dark\" tone=\"text\" label=\"Esporta Excel\"></mds-button>\n  </mds-button-dropdown>\n</mds-button-group>\n```\n\n#### In a Row of Actions That Stacks\n\nStretch the group as any other action of the row: under `--magma-container-actions` of its container (`@max-actions:`), `actions/stacked` puts every labelled action at the full width, and the group shares that width among its labelled members, the joined corners as before. No part or custom property is needed.\n\n```html\n<div class=\"@container\">\n  <div class=\"flex justify-end gap-inline @max-actions:flex-col @max-actions:*:self-stretch\">\n    <mds-button variant=\"dark\" tone=\"outline\" label=\"Annulla\"></mds-button>\n    <mds-button-group>\n      <mds-button variant=\"primary\" tone=\"outline\" label=\"Salva come bozza\"></mds-button>\n      <mds-button variant=\"primary\" label=\"Pubblica\"></mds-button>\n    </mds-button-group>\n  </div>\n</div>\n```\n\n#### Disabled Buttons Inside a Group\n\nDisable individual buttons with the `disabled` boolean attribute. Never use `disabled=\"false\"` - remove the attribute to re-enable. The group itself has no `disabled` prop.\n\n```html\n<mds-button-group>\n  <mds-button label=\"Approva\" variant=\"success\" tone=\"strong\"></mds-button>\n  <mds-button label=\"Rifiuta\" variant=\"error\" tone=\"outline\" disabled></mds-button>\n</mds-button-group>\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-button-group>`. 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 Nest Raw `<button>` Elements Inside the Group\n\nThe group is part of the Magma component system and is designed to host `<mds-button>` (and sibling `mds-*` action) components. Raw `<button>` elements bypass theming, focus styles, and accessibility defaults.\n\n```html\n<!-- INCORRECT -->\n<mds-button-group>\n  <button class=\"btn\">Salva</button>\n  <button class=\"btn\">Annulla</button>\n</mds-button-group>\n\n<!-- CORRECT -->\n<mds-button-group>\n  <mds-button label=\"Salva\" variant=\"primary\" tone=\"strong\"></mds-button>\n  <mds-button label=\"Annulla\" variant=\"dark\" tone=\"outline\"></mds-button>\n</mds-button-group>\n```\n\n#### Do Not Wrap the Group in an Anchor\n\n`<mds-button-group>` contains interactive controls; nesting the whole group inside `<a>` creates nested interactives, breaks keyboard semantics, and fails accessibility audits. Use the `href` prop on individual `<mds-button>` elements instead.\n\n```html\n<!-- INCORRECT -->\n<a href=\"/azioni\">\n  <mds-button-group>\n    <mds-button label=\"Vai\" variant=\"primary\"></mds-button>\n  </mds-button-group>\n</a>\n\n<!-- CORRECT -->\n<mds-button-group>\n  <mds-button label=\"Vai\" href=\"/azioni\" variant=\"primary\"></mds-button>\n</mds-button-group>\n```\n\n#### Do Not Omit `aria-label` on Icon-Only Buttons Inside a Group\n\nGrouping icon-only buttons does not remove the requirement for an accessible name on each child. Without it `mds-button` falls back to the last segment of the icon slug (\"undo\"), which names the icon, not the action.\n\n```html\n<!-- INCORRECT -->\n<mds-button-group>\n  <mds-button icon=\"mi/baseline/undo\" variant=\"dark\" tone=\"text\"></mds-button>\n  <mds-button icon=\"mi/baseline/redo\" variant=\"dark\" tone=\"text\"></mds-button>\n</mds-button-group>\n\n<!-- CORRECT -->\n<mds-button-group>\n  <mds-button icon=\"mi/baseline/undo\" aria-label=\"Annulla\" variant=\"dark\" tone=\"text\"></mds-button>\n  <mds-button icon=\"mi/baseline/redo\" aria-label=\"Ripristina\" variant=\"dark\" tone=\"text\"></mds-button>\n</mds-button-group>\n```\n\n#### Do Not Nest `<mds-button-group>` Inside Another Group\n\nThe component is a flat layout primitive; nesting groups creates redundant flex containers that break the consistent spacing and group visual coherence. Keep the hierarchy flat.\n\n```html\n<!-- INCORRECT -->\n<mds-button-group>\n  <mds-button-group>\n    <mds-button label=\"Salva\" variant=\"primary\" tone=\"strong\"></mds-button>\n    <mds-button label=\"Bozza\" variant=\"primary\" tone=\"outline\"></mds-button>\n  </mds-button-group>\n  <mds-button label=\"Annulla\" variant=\"dark\" tone=\"text\"></mds-button>\n</mds-button-group>\n\n<!-- CORRECT -->\n<mds-button-group>\n  <mds-button label=\"Salva\" variant=\"primary\" tone=\"strong\"></mds-button>\n  <mds-button label=\"Bozza\" variant=\"primary\" tone=\"outline\"></mds-button>\n  <mds-button label=\"Annulla\" variant=\"dark\" tone=\"text\"></mds-button>\n</mds-button-group>\n```\n\n#### Do Not Override Spacing with Inline Styles\n\nThe component manages its own gap via a design-token-backed CSS value. Setting inline `gap`, `margin`, or `padding` on the host or child buttons breaks the token contract and may produce inconsistent spacing across themes.\n\n```css\n/* INCORRECT */\nmds-button-group {\n  gap: 16px;\n}\nmds-button-group mds-button {\n  margin-right: 8px;\n}\n\n/* CORRECT - let the component handle spacing; style only what it exposes */\nmds-button-group {\n  /* no gap or margin overrides needed */\n}\n```\n"
      },
      "props": [],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [],
      "slots": [
        {
          "name": "",
          "docs": "Add `mds-button` or `mds-button-dropdown` elements to this slot."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "ui-button-group--docs"
    }
  ]
}
