{
  "component": "Chip",
  "package": "@blade-ai/weft",
  "status": "stable",
  "version": "0.1.0",
  "updated": "2026-11-24",
  "import": "import { Chip, ChipGroup } from \"@blade-ai/weft/components/chip\";",
  "docs": "/components/chip",
  "description": "A compact toggle for filtering or choosing among a few short options. Chips live in a ChipGroup, which owns the selection: single (radio group) or multiple (checkbox group).",
  "props": [
    {
      "name": "Chip.label",
      "type": "string",
      "default": null,
      "required": true,
      "description": "Visible chip text. Keep it to one or two words."
    },
    {
      "name": "Chip.value",
      "type": "string",
      "default": null,
      "required": true,
      "description": "Value ChipGroup reports when this chip is selected. Unique within the group."
    },
    {
      "name": "Chip.accessibilityLabel",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Accessible name when the label is an abbreviation or icon-only. Becomes aria-label."
    },
    {
      "name": "Chip.leadingIcon",
      "type": "IconComponent",
      "default": null,
      "required": false,
      "description": "Optional icon before the label. Decorative: aria-hidden."
    },
    {
      "name": "Chip.intent",
      "type": "\"none\" | \"positive\" | \"negative\"",
      "default": "none",
      "required": false,
      "description": "Tint of the selected chip. Inherits from ChipGroup."
    },
    {
      "name": "Chip.isDisabled",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "Native disabled: not focusable, not submitted, 50% opacity. Inherits from ChipGroup."
    },
    {
      "name": "Chip.isReadOnly",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "Focusable and submitted, value cannot change. Not in Blade Chip: UNDEFINED · needs decision."
    },
    {
      "name": "Chip.testID",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Test selector on the chip input (data-testid)."
    },
    {
      "name": "ChipGroup.label",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Legend text that names the group. One of label or accessibilityLabel is required."
    },
    {
      "name": "ChipGroup.accessibilityLabel",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Group name when there is no visible legend (toolbar filters). Becomes aria-label."
    },
    {
      "name": "ChipGroup.selectionType",
      "type": "\"single\" | \"multiple\"",
      "default": "single",
      "required": false,
      "description": "single: radio group, one value. multiple: checkbox group, any number."
    },
    {
      "name": "ChipGroup.value",
      "type": "string | string[]",
      "default": null,
      "required": false,
      "description": "Selected value(s), controlled. string for single, string[] for multiple. Required with onChange when controlled."
    },
    {
      "name": "ChipGroup.defaultValue",
      "type": "string | string[]",
      "default": null,
      "required": false,
      "description": "Initial selected value(s) when uncontrolled."
    },
    {
      "name": "ChipGroup.onChange",
      "type": "({ name: string; values: string[] }) => void",
      "default": null,
      "required": false,
      "description": "Fires when the selection changes (click, Space, arrow keys in single). Required when controlled."
    },
    {
      "name": "ChipGroup.name",
      "type": "string",
      "default": "auto id",
      "required": false,
      "description": "Form field name shared by every chip. Required for forms."
    },
    {
      "name": "ChipGroup.size",
      "type": "\"small\" | \"medium\" | \"large\"",
      "default": "medium",
      "required": false,
      "description": "Chip height 28 / 32 / 36px."
    },
    {
      "name": "ChipGroup.intent",
      "type": "\"none\" | \"positive\" | \"negative\"",
      "default": "none",
      "required": false,
      "description": "Tint of selected chips; a chip can override it."
    },
    {
      "name": "ChipGroup.helpText",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Hint under the group, linked to the fieldset with aria-describedby."
    },
    {
      "name": "ChipGroup.errorText",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Shown once under the group when validationState is \"error\"; replaces helpText."
    },
    {
      "name": "ChipGroup.validationState",
      "type": "\"none\" | \"error\"",
      "default": "none",
      "required": false,
      "description": "\"error\" gives every chip the red outline (proposal) and sets aria-invalid on the fieldset."
    },
    {
      "name": "ChipGroup.isDisabled",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "Disables every chip."
    },
    {
      "name": "ChipGroup.isRequired",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "At least one chip selected. Visible marker: UNDEFINED."
    },
    {
      "name": "ChipGroup.autoFocus",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "Focuses the selected chip on mount, otherwise the first chip. Not in Blade: UNDEFINED."
    },
    {
      "name": "ChipGroup.orientation",
      "type": "\"horizontal\" | \"vertical\"",
      "default": "horizontal",
      "required": false,
      "description": "Row that wraps (gap spacing-3) or a column. Not in Blade ChipGroup: UNDEFINED · needs decision."
    },
    {
      "name": "ChipGroup.testID",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Test selector on the fieldset (data-testid)."
    }
  ],
  "undefined": [
    "Pressed fill for a selected chip (no Theme token; the hover fill is reused)",
    "Chip.isReadOnly: not in Blade; look and behaviour (gray selected fill proposed)",
    "Per-chip invalid treatment (red outline proposed)",
    "When the error first shows: on submit (fallback) or on change",
    "Clicking the selected chip again in single mode (native radios keep it)",
    "Visible required marker on the legend",
    "Home / End keys",
    "Horizontal scroll vs wrap on narrow screens (fallback: wrap)",
    "Radius: square (Weft) or pill (Blade)",
    "A second non-colour cue for \"selected\" (the fill alone is 1.10:1)",
    "ChipGroup.orientation and autoFocus: not in Blade"
  ],
  "sizes": {
    "chipHeight": "small --size-28 · medium --size-32 · large --size-36",
    "paddingX": "small --spacing-16 · medium --spacing-4 · large --spacing-17",
    "borderRadius": "1px (--border-width-thin) · --border-radius-none",
    "labelFontSize": "small --typography-fonts-size-75 · medium and large --typography-fonts-size-100",
    "labelLineHeight": "small --typography-line-heights-50 · medium and large --typography-line-heights-100",
    "labelWeight": "--typography-fonts-weight-medium",
    "leadingIcon": "small --size-12 · medium --size-14 · large --size-16",
    "iconToLabelGap": "--spacing-15",
    "chipToChipGap": "--spacing-3",
    "legendToChips": "--spacing-3",
    "legendFont": "--typography-fonts-size-1200",
    "helpErrorFont": "--typography-fonts-size-75",
    "focusRing": "3px box-shadow",
    "rowWrap": "flex-wrap: wrap"
  },
  "states": [
    {
      "name": "default · unselected",
      "trigger": "resting",
      "tokens": {
        "bg": "surface.background.gray.subtle",
        "border": "interactive.border.gray.default",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "default · selected",
      "trigger": "resting",
      "tokens": {
        "bg": "interactive.background.primary.faded",
        "border": "interactive.border.primary.default",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "hover · unselected",
      "trigger": "pointer over the chip",
      "tokens": {
        "bg": "interactive.background.gray.faded",
        "border": "interactive.border.gray.highlighted",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "hover · selected",
      "trigger": "pointer over the chip",
      "tokens": {
        "bg": "interactive.background.primary.fadedHighlighted",
        "border": "interactive.border.primary.default",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "focus-visible · unselected",
      "trigger": "keyboard focus",
      "tokens": {
        "bg": "surface.background.gray.subtle",
        "border": "interactive.border.primary.default + ring",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "focus-visible · selected",
      "trigger": "keyboard focus",
      "tokens": {
        "bg": "interactive.background.primary.faded",
        "border": "interactive.border.primary.default + ring",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "pressed · unselected",
      "trigger": "pointer or Space down",
      "tokens": {
        "bg": "interactive.background.gray.fadedHighlighted",
        "border": "interactive.border.gray.highlighted",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "pressed · selected",
      "trigger": "pointer or Space down",
      "tokens": {
        "bg": "UNDEFINED · needs decision (fadedHighlighted placeholder)",
        "border": "interactive.border.primary.default",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "disabled · unselected",
      "trigger": "isDisabled",
      "tokens": {
        "bg": "interactive.background.gray.disabled",
        "border": "interactive.border.gray.default",
        "label": "interactive.text.gray.normal + opacity 50%"
      }
    },
    {
      "name": "disabled · selected",
      "trigger": "isDisabled",
      "tokens": {
        "bg": "interactive.background.primary.faded",
        "border": "interactive.border.primary.default",
        "label": "interactive.text.gray.normal + opacity 50%"
      }
    },
    {
      "name": "read-only · unselected",
      "trigger": "isReadOnly (UNDEFINED)",
      "tokens": {
        "bg": "surface.background.gray.subtle",
        "border": "interactive.border.gray.default",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "read-only · selected",
      "trigger": "isReadOnly (proposed, not approved)",
      "tokens": {
        "bg": "interactive.background.gray.default",
        "border": "interactive.border.gray.default",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "invalid · both",
      "trigger": "validationState=\"error\" (proposal)",
      "tokens": {
        "bg": "default fill for the value",
        "border": "feedback.border.negative.intense",
        "label": "interactive.text.gray.normal"
      }
    },
    {
      "name": "positive · selected",
      "trigger": "intent=\"positive\"",
      "tokens": {
        "bg": "interactive.background.positive.faded",
        "border": "interactive.border.positive.default",
        "label": "interactive.text.positive.normal"
      }
    },
    {
      "name": "positive · hover",
      "trigger": "intent=\"positive\", pointer over",
      "tokens": {
        "bg": "interactive.background.positive.fadedHighlighted",
        "border": "interactive.border.positive.default",
        "label": "interactive.text.positive.normal"
      }
    },
    {
      "name": "negative · selected",
      "trigger": "intent=\"negative\"",
      "tokens": {
        "bg": "interactive.background.negative.faded",
        "border": "interactive.border.negative.default",
        "label": "interactive.text.negative.normal"
      }
    },
    {
      "name": "negative · hover",
      "trigger": "intent=\"negative\", pointer over",
      "tokens": {
        "bg": "interactive.background.negative.fadedHighlighted",
        "border": "interactive.border.negative.default",
        "label": "interactive.text.negative.normal"
      }
    }
  ],
  "behaviour": {
    "selectSingle": "Click, Space or an arrow key selects the chip; the previous one is cleared. onChange fires once with values = [value].",
    "toggleMultiple": "Click or Space flips the focused chip; onChange fires with the full values array.",
    "deselectSingle": "Clicking the selected chip again: UNDEFINED · needs decision (native radios keep it).",
    "controlled": "value set: render it; never change internal state.",
    "uncontrolled": "defaultValue sets the first value; the group owns state afterwards.",
    "validationShow": "errorText shown when validationState=\"error\". First trigger (on submit vs on change): UNDEFINED.",
    "validationClear": "Re-validate on every change; once valid, the error clears immediately (approved field rule).",
    "errorVsHelp": "errorText replaces helpText in the same slot; never both.",
    "groupError": "One message under the group; every chip gets the red outline (proposal) and aria-invalid on the fieldset.",
    "disabled": "Native disabled on every input: no focus, no hover, not submitted, opacity 50%.",
    "readOnly": "Not in Blade Chip. Focusable, submitted, value can't change; gray selected fill. UNDEFINED.",
    "requiredMarker": "isRequired visual marker on the legend: UNDEFINED · needs decision.",
    "autoFocus": "Focus goes to the selected chip, otherwise the first chip (approved field rule).",
    "focusRing": "Only on :focus-visible (keyboard). Mouse and touch show no ring.",
    "hover": "Pointer only; no hover on touch devices.",
    "pressed": "Shown while pointer or Space is down; value changes on release.",
    "labelWrap": "Labels never wrap inside a chip (white-space: nowrap); the row wraps instead.",
    "overflowMobile": "Horizontal scroll vs wrap on narrow screens: UNDEFINED · needs decision (fallback: wrap)."
  },
  "keyboard": [
    {
      "key": "Tab / Shift+Tab",
      "action": "single: one tab stop at the selected chip (or the first). multiple: each chip is a tab stop. Disabled skipped."
    },
    {
      "key": "Arrow keys",
      "action": "single: previous / next chip, moves focus and selects, wraps at the ends. multiple: no effect."
    },
    {
      "key": "Space",
      "action": "single: selects the focused chip. multiple: toggles it. Ignored when read-only or disabled."
    },
    {
      "key": "Enter",
      "action": "No change. Submits the surrounding form."
    },
    {
      "key": "Click",
      "action": "Selects (single) or toggles (multiple) and focuses the chip without a ring."
    },
    {
      "key": "Home / End",
      "action": "UNDEFINED · needs decision."
    }
  ],
  "accessibility": {
    "summary": "Native radio group (single) or checkbox group (multiple); no key handlers. Markup: <fieldset><legend><label><input type=\"radio|checkbox\"><svg aria-hidden/><span label/></label>...<div help|error/></fieldset>.",
    "aria": [
      {
        "element": "fieldset",
        "attributes": "aria-describedby",
        "when": "id of helpText or errorText"
      },
      {
        "element": "fieldset",
        "attributes": "aria-invalid=\"true\"",
        "when": "validationState = \"error\""
      },
      {
        "element": "fieldset",
        "attributes": "aria-label",
        "when": "accessibilityLabel (no visible legend)"
      },
      {
        "element": "legend",
        "attributes": "text",
        "when": "ChipGroup label"
      },
      {
        "element": "input",
        "attributes": "type",
        "when": "\"radio\" (single) · \"checkbox\" (multiple)"
      },
      {
        "element": "input",
        "attributes": "name",
        "when": "ChipGroup name (shared)"
      },
      {
        "element": "input",
        "attributes": "value",
        "when": "Chip value"
      },
      {
        "element": "input",
        "attributes": "checked",
        "when": "value is in the group value"
      },
      {
        "element": "input",
        "attributes": "disabled",
        "when": "isDisabled"
      },
      {
        "element": "input",
        "attributes": "required",
        "when": "isRequired (single only; multiple validates in JS)"
      },
      {
        "element": "input",
        "attributes": "aria-label",
        "when": "Chip accessibilityLabel"
      },
      {
        "element": "label",
        "attributes": "text",
        "when": "Chip label"
      },
      {
        "element": "leading icon",
        "attributes": "aria-hidden=\"true\"",
        "when": "Always"
      }
    ]
  },
  "usage": {
    "do": [
      "Use native <input type=\"radio\"> (single) or \"checkbox\" (multiple) inside a real <label>.",
      "Wrap chips in ChipGroup: fieldset + legend, one name, one value.",
      "Use only the Theme tokens listed under States for colour and Global tokens for size and spacing.",
      "Keep the selected outline (interactive/border/primary/default); fill alone is 1.10:1.",
      "Write 1 to 2 word labels in sentence case, e.g. \"Live · Drafts · Archived\".",
      "Clear the error as soon as the selection becomes valid."
    ],
    "dont": [
      "Don't add component tokens (chip/bg, chip/border). Add a Theme token or flag UNDEFINED.",
      "Don't use chips for more than about 7 options; use Select or Combobox.",
      "Don't use chips as buttons that run a command (export, delete).",
      "Don't use multiple when the options exclude each other.",
      "Don't show the focus ring on mouse click or hide the input with display:none.",
      "Don't mention any other product name in sample copy; the product is Blade AI."
    ]
  },
  "example": "<ChipGroup label=\"Status\" defaultValue=\"live\"><Chip label=\"Live\" value=\"live\" /><Chip label=\"Drafts\" value=\"drafts\" /><Chip label=\"Archived\" value=\"archived\" /></ChipGroup>"
}
