{
  "package": "@blade-ai/weft",
  "status": "stable",
  "version": "0.1.0",
  "updated": "2026-11-24",
  "component": "ButtonGroup",
  "import": "import { ButtonGroup } from \"@blade-ai/weft/components/button-group\";",
  "iconsImport": "import { Button } from \"@blade-ai/weft/components/button\";",
  "docs": "/components/button-group",
  "description": "Joins 2–3 related Buttons into one control: a split button, view options or a small toolbar. Square, flat and token-driven; items are real Buttons.",
  "props": [
    {
      "name": "children",
      "type": "ReactNode (<Button>[])",
      "default": null,
      "required": true,
      "description": "2–3 Buttons, or Button + menu trigger (split). Keep every item the same kind (all buttons or all links)."
    },
    {
      "name": "variant",
      "type": "\"primary\" | \"secondary\" | \"tertiary\"",
      "values": [
        "primary",
        "secondary",
        "tertiary"
      ],
      "default": "primary",
      "required": false,
      "description": "Applied to every item; ghost / link not supported."
    },
    {
      "name": "size",
      "type": "\"xsmall\" | \"small\" | \"medium\" | \"large\"",
      "values": [
        "xsmall",
        "small",
        "medium",
        "large"
      ],
      "default": "medium",
      "required": false,
      "description": "Applied to every item. xsmall is not drawn on the sheet."
    },
    {
      "name": "color",
      "type": "\"primary\" | \"white\" | \"positive\" | \"negative\"",
      "values": [
        "primary",
        "white",
        "positive",
        "negative"
      ],
      "default": "primary",
      "required": false,
      "description": "Seam tokens for white / positive / negative: UNDEFINED · needs decision."
    },
    {
      "name": "isDisabled",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "Disables every item; an item's own isDisabled can only add, never re-enable."
    },
    {
      "name": "isFullWidth",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "Group 100%; items share the width equally."
    },
    {
      "name": "orientation",
      "type": "\"horizontal\" | \"vertical\"",
      "values": [
        "horizontal",
        "vertical"
      ],
      "default": "horizontal",
      "required": false,
      "description": "Sets aria-orientation; vertical is not drawn on the sheet (seam on top)."
    },
    {
      "name": "accessibilityLabel",
      "type": "string",
      "default": null,
      "required": true,
      "description": "Rendered as aria-label on role=\"group\". A missing label warns in development."
    },
    {
      "name": "value · onChange",
      "type": "string · (value: string) => void",
      "default": null,
      "required": false,
      "description": "UNDEFINED · needs decision (only if ButtonGroup becomes a toggle group). Not built."
    }
  ],
  "states": [
    {
      "name": "default",
      "trigger": "Rest",
      "tokens": "items = Button rest tokens · radius border.radius.none · secondary outer border 1px interactive.border.gray.default",
      "notes": "—"
    },
    {
      "name": "hover (item)",
      "trigger": "Pointer over one item",
      "tokens": "primary interactive.background.primary.highlighted · secondary interactive.background.gray.default · tertiary interactive.background.gray.highlighted",
      "notes": "Seams unchanged."
    },
    {
      "name": "focus-visible (item)",
      "trigger": "Keyboard focus on one item",
      "tokens": "inset 1px interactive.border.primary.default · ring 3px interactive.border.primary.faded, z-index above neighbours",
      "notes": "One ring at a time."
    },
    {
      "name": "active / pressed",
      "trigger": "Pointer down on an item",
      "tokens": "UNDEFINED · needs decision (inherits Button)",
      "notes": "Renders the hover tokens until decided."
    },
    {
      "name": "selected / toggled",
      "trigger": "Item chosen",
      "tokens": "UNDEFINED · needs decision (not a toggle group; no selected token)",
      "notes": "If added: aria-pressed per item. Not built."
    },
    {
      "name": "disabled (group)",
      "trigger": "isDisabled on ButtonGroup",
      "tokens": "opacity.600 (50%) on the whole group",
      "notes": "Every item gets native disabled."
    },
    {
      "name": "disabled (single item)",
      "trigger": "isDisabled on one Button",
      "tokens": "item opacity.600 · seams + outer border unchanged",
      "notes": "Seam fade: UNDEFINED · needs decision."
    },
    {
      "name": "first / middle / last",
      "trigger": "Item position",
      "tokens": "first: no seam · middle, last: 1px seam on the left (top when vertical) · primary interactive.background.primary.highlighted · secondary interactive.border.gray.default · tertiary surface.background.gray.subtle",
      "notes": "Corners border.radius.none. The Agent Spec names surface.border.primary.normal for the primary seam; the Paper artboard draws interactive.background.primary.highlighted, which is what is built."
    },
    {
      "name": "focus moving",
      "trigger": "Tab / arrow keys",
      "tokens": "ring moves to the focused item",
      "notes": "Tab-through vs roving tabindex: UNDEFINED · needs decision. Tab-through built."
    },
    {
      "name": "overflow",
      "trigger": "Items wider than container",
      "tokens": "UNDEFINED · needs decision (scroll / More menu); max items undefined",
      "notes": "Never wrap to two rows."
    }
  ],
  "sizes": [
    {
      "property": "Item height",
      "value": "28 / 32 / 40 / 48px",
      "token": "size.28 · 32 · 40 · 48 (from Button)"
    },
    {
      "property": "Item padding-x",
      "value": "10 / 14 / 20 / 24px",
      "token": "spacing.16 · 17 · 6 · 7 (from Button)"
    },
    {
      "property": "Gap between items",
      "value": "0 (joined)",
      "token": "—"
    },
    {
      "property": "Seam width",
      "value": "1px, all sizes",
      "token": "border.width.thin"
    },
    {
      "property": "Outer and inner radius",
      "value": "0",
      "token": "border.radius.none"
    },
    {
      "property": "Focus ring",
      "value": "3px on the focused item only",
      "token": "interactive.border.primary.faded · border.width.3"
    },
    {
      "property": "Item count",
      "value": "2–3 shown",
      "token": "max items: UNDEFINED · needs decision"
    }
  ],
  "behaviour": {
    "group": "Always renders role=\"group\" with aria-label = accessibilityLabel (e.g. \"Date range\"). A missing accessibilityLabel is an error; the component warns in development.",
    "focus": "Tab-through: every item is a tab stop. Roving tabindex (one tab stop, arrows move) is UNDEFINED · needs decision; required if the group becomes a toggle group or toolbar.",
    "type": "Every item renders type=\"button\" unless set, so a group inside a <form> never submits.",
    "loading": "An item with isLoading ignores clicks (Button rule). Group-level isLoading: UNDEFINED · needs decision.",
    "linkVsButton": "An item with href renders <a href> (Button rule); keep all items the same kind inside one group.",
    "inheritance": "variant, size, color and isDisabled on the group override item props. Item isDisabled can only add, never re-enable.",
    "joins": "Seams are a 1px left border on items 2..n (top border when vertical). No margins between items. Secondary gets a 1px outer border on the wrapper.",
    "split": "Menu trigger is an icon-only Button with accessibilityLabel (\"More actions\"), aria-haspopup=\"menu\" and aria-expanded."
  },
  "keyboard": [
    {
      "key": "Tab / Shift+Tab",
      "action": "Moves to the next / previous item (tab-through). Disabled items are skipped."
    },
    {
      "key": "Arrow keys",
      "action": "No effect today. With roving tabindex: ← → (↑ ↓ vertical) move focus. UNDEFINED · needs decision."
    },
    {
      "key": "Home / End",
      "action": "Only with roving tabindex: first / last item."
    },
    {
      "key": "Enter / Space",
      "action": "Activates the focused item (Button rules)."
    }
  ],
  "accessibility": {
    "summary": "Wrapper is a labelled group; items are native Buttons.",
    "aria": [
      {
        "element": "wrapper <div>",
        "attributes": "role=\"group\" · aria-label = accessibilityLabel",
        "when": "Always (required)"
      },
      {
        "element": "wrapper <div>",
        "attributes": "aria-orientation=\"vertical\"",
        "when": "orientation = vertical"
      },
      {
        "element": "wrapper <div>",
        "attributes": "role=\"toolbar\" for icon toolbars: UNDEFINED · needs decision",
        "when": "Needs roving tabindex"
      },
      {
        "element": "items",
        "attributes": "<button> / <a> per Button ARIA rules",
        "when": "Always"
      },
      {
        "element": "items (toggle)",
        "attributes": "aria-pressed: UNDEFINED · needs decision",
        "when": "Only if selection is added"
      },
      {
        "element": "split menu trigger",
        "attributes": "aria-label · aria-haspopup=\"menu\" · aria-expanded",
        "when": "Split button"
      }
    ]
  },
  "usage": {
    "do": [
      "Group only closely related actions (view options, split button, a small toolbar).",
      "Give every group an accessibilityLabel.",
      "Keep one variant and size across the whole group."
    ],
    "dont": [
      "Use ButtonGroup as a tab bar or segmented selector until selection is decided.",
      "Mix variants, sizes, or links and buttons inside one group.",
      "Add gaps or rounded ends; items join with a 1px seam."
    ]
  },
  "example": "<ButtonGroup variant=\"secondary\" size=\"medium\" accessibilityLabel=\"Date range\"><Button>Day</Button><Button>Week</Button><Button>Month</Button></ButtonGroup>"
}
