{
  "name": "Select",
  "package": "@blade-ai/weft",
  "version": "0.4.0",
  "status": "stable",
  "category": "Inputs",
  "summary": "Lets people pick one option from a short, known list. A trigger opens a menu of options; the choice shows in the trigger.",
  "import": "import { Select, SelectGroup, SelectLabel, SelectItem, SelectSeparator } from \"@blade-ai/weft\";",
  "docs": "/components/select",
  "anatomy": ["Select (Field: label, trigger, help / error text)", "SelectTrigger", "SelectContent (listbox)", "SelectGroup", "SelectLabel", "SelectItem", "SelectSeparator"],
  "props": {
    "Select": [
      { "name": "label", "type": "string", "required": true, "description": "Accessible name of the trigger." },
      { "name": "labelPosition", "type": "\"top\" | \"left\"", "default": "top", "description": "left = 120px label column." },
      { "name": "placeholder", "type": "string", "default": "Select…", "description": "Shown when value is empty." },
      { "name": "value", "type": "string", "description": "Controlled value. Single value only; multi-select: use Combobox." },
      { "name": "defaultValue", "type": "string", "description": "Uncontrolled initial value." },
      { "name": "onValueChange", "type": "(value: string) => void" },
      { "name": "size", "type": "\"small\" | \"medium\" | \"large\"", "default": "medium", "description": "Trigger height 32 / 36 / 48. Menu options stay 32px on desktop." },
      { "name": "validationState", "type": "\"none\" | \"success\" | \"error\"", "default": "none", "description": "error sets aria-invalid and shows errorText." },
      { "name": "helpText", "type": "string", "description": "One message at a time." },
      { "name": "successText", "type": "string" },
      { "name": "errorText", "type": "string" },
      { "name": "isRequired", "type": "boolean", "default": false },
      { "name": "isDisabled", "type": "boolean", "default": false },
      { "name": "isLoading", "type": "boolean", "default": false, "description": "Swaps the chevron for a spinner and sets aria-busy." },
      { "name": "isReadOnly", "type": "boolean", "default": false, "note": "Tokens UNDEFINED · needs decision" },
      { "name": "isOpen", "type": "boolean", "description": "Controlled open state." },
      { "name": "defaultOpen", "type": "boolean", "default": false },
      { "name": "onOpenChange", "type": "(open: boolean) => void" },
      { "name": "position", "type": "\"popper\" | \"item-aligned\"", "default": "popper", "description": "Predictable placement and flip." },
      { "name": "name", "type": "string", "description": "Hidden native select for form submit." }
    ],
    "SelectItem": [
      { "name": "value", "type": "string", "required": true },
      { "name": "isDisabled", "type": "boolean", "default": false },
      { "name": "description", "type": "string" },
      { "name": "icon", "type": "IconComponent" },
      { "name": "textValue", "type": "string", "description": "Feeds typeahead." }
    ],
    "SelectGroup": [],
    "SelectLabel": [],
    "SelectSeparator": []
  },
  "sizes": {
    "small": { "height": "size.32", "paddingInline": "spacing.3" },
    "medium": { "height": "size.36", "paddingInline": "spacing.4" },
    "large": { "height": "size.48", "paddingInline": "spacing.5" },
    "option": { "minHeight": "size.32", "paddingInline": "spacing.3" },
    "content": { "padding": "spacing.2", "maxHeight": "size.240" }
  },
  "states": {
    "trigger": {
      "default": { "background": "surface.background.gray.subtle", "border": "interactive.border.gray.default", "placeholder": "surface.text.gray.muted" },
      "filled": { "text": "surface.text.gray.normal" },
      "hover": { "border": "interactive.border.gray.highlighted" },
      "focus": { "border": "interactive.border.primary.default", "ring": "interactive.border.primary.faded (size.3)" },
      "open": { "border": "interactive.border.primary.default", "icon": "chevron up" },
      "disabled": { "background": "interactive.background.gray.disabled", "opacity": "opacity.600" },
      "readOnly": { "background": "surface.background.gray.moderate", "border": "surface.border.gray.muted", "note": "Tokens UNDEFINED · needs decision" },
      "loading": { "icon": "spinner", "aria": "aria-busy=\"true\"" },
      "invalid": { "border": "feedback.border.negative.intense", "message": "feedback.text.negative.intense" },
      "success": { "border": "interactive.border.positive.default", "icon": "feedback.icon.positive.intense" }
    },
    "content": {
      "background": "popup.background.gray.subtle",
      "border": "popup.border.gray.subtle",
      "shadow": "elevation.mid.raised"
    },
    "item": {
      "default": { "background": "popup.background.gray.subtle", "text": "interactive.text.gray.normal" },
      "highlighted": { "background": "interactive.background.gray.default" },
      "selected": { "background": "interactive.background.primary.faded", "icon": "check · interactive.icon.gray.normal" },
      "disabled": { "text": "interactive.text.gray.disabled" },
      "withDescription": { "description": "surface.text.gray.muted", "minHeight": "size.48" },
      "groupLabel": { "text": "surface.text.gray.muted" },
      "separator": { "background": "surface.border.gray.muted" },
      "empty": { "text": "surface.text.gray.muted", "role": "status" }
    }
  },
  "radius": "var(--weft-radius) (default border.radius.none)",
  "behaviour": {
    "keyboard": {
      "closed": {
        "ArrowDown / ArrowUp": "Opens; highlights selected (or first / last).",
        "Home / End": "Opens and highlights first / last.",
        "Enter / Space": "Opens.",
        "Escape": "No action.",
        "Tab / Shift+Tab": "Moves focus to next / previous field.",
        "A–Z (typeahead)": "Selects next matching option without opening."
      },
      "open": {
        "ArrowDown / ArrowUp": "Moves highlight one enabled option; no wrap.",
        "Home / End": "Highlights first / last enabled option.",
        "Enter / Space": "Selects highlighted option, closes, focus to trigger.",
        "Escape": "Closes without change, focus to trigger.",
        "Tab / Shift+Tab": "Closes without selecting and moves focus.",
        "A–Z (typeahead)": "Highlights next matching option."
      },
      "undefined": ["PageUp / PageDown: needs decision (jump 10 options?)"]
    },
    "pointer": ["Click trigger toggles the menu.", "Click outside closes without change.", "Disabled options are skipped and not selectable."]
  },
  "accessibility": {
    "pattern": "Select-only combobox (WAI-ARIA APG)",
    "SelectTrigger": "role=\"combobox\" · aria-haspopup=\"listbox\" · aria-expanded · aria-controls → listbox id · aria-labelledby → label",
    "triggerState": "aria-invalid · aria-describedby → help / error · aria-required · aria-busy · disabled",
    "SelectContent": "role=\"listbox\" · id · aria-labelledby → label",
    "SelectItem": "role=\"option\" · aria-selected · aria-disabled · data-highlighted · check icon aria-hidden",
    "SelectGroup": "role=\"group\" · aria-labelledby → SelectLabel id",
    "SelectSeparator": "role=\"separator\" (aria-hidden)",
    "empty": "role=\"status\""
  },
  "usage": {
    "do": [
      "Use Select for 5–15 known options; Radio group for 2–4; Combobox for long, searchable or multi-select lists.",
      "Always show a visible label; the placeholder invites a choice (\"Select a model\").",
      "Order options logically and group them with SelectLabel when it helps.",
      "Bind only Theme and Global token names; no component tokens.",
      "Use the Drawer and size large on mobile."
    ],
    "dont": [
      "Put the label or instructions in the placeholder.",
      "Mark the selected option with colour alone; keep the check and aria-selected.",
      "Hide disabled options or let the keyboard land on them.",
      "Use sentences, mixed formats or \"Other\" at the top of the list.",
      "Round the corners or add raw colours to the trigger, menu or options."
    ]
  },
  "example": "<Select label=\"Model\" placeholder=\"Select a model\" value={model} onValueChange={setModel}>\n  <SelectGroup><SelectLabel>Fast</SelectLabel>\n    <SelectItem value=\"blade-swift\">Blade Swift</SelectItem>\n  </SelectGroup>\n  <SelectSeparator />\n  <SelectGroup><SelectLabel>Reasoning</SelectLabel>\n    <SelectItem value=\"blade-pro\">Blade Pro</SelectItem>\n  </SelectGroup>\n</Select>"
}
