{
  "generatedFrom": "select.contract.json",
  "component": "Select",
  "slug": "select",
  "group": "Data Entry",
  "tier": "composite-antd",
  "summary": "Pick one value (or several) from a known set — with type-to-search — rendered through the shared Select.",
  "install": {
    "package": "@ahaslides-product/design",
    "registry": "https://npm.pkg.github.com",
    "scope": "@ahaslides-product",
    "auth": "Published to GitHub Packages — needs a GitHub token with read:packages. Configure the @ahaslides-product scope in .npmrc before installing.",
    "npmrc": "@ahaslides-product:registry=https://npm.pkg.github.com\n//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}   # a GitHub token with read:packages",
    "command": "npm i @ahaslides-product/design",
    "tokenLayer": "import '@ahaslides-product/design/tokens.css';",
    "import": "import '@ahaslides-product/design/select-theme';",
    "element": null,
    "registers": null
  },
  "feeds": {
    "doc": "https://ahaslides-product.github.io/ahaslides-design/select/index.html",
    "md": "https://ahaslides-product.github.io/ahaslides-design/select/select.md",
    "agentJson": "https://ahaslides-product.github.io/ahaslides-design/select.agent.json",
    "llms": "https://ahaslides-product.github.io/ahaslides-design/select.llms.txt",
    "index": "https://ahaslides-product.github.io/ahaslides-design/llms.txt"
  },
  "recommendedSnippet": "html",
  "vibeCode": "Emit the HTML snippet by default — a CDN-React runnable page (React + antd loaded from a CDN, no build step) — React/Vue use the same shared-themed DataTable via your bundler. Paste into an .html file and it renders with no build step.",
  "frameworks": {
    "react": {
      "package": "antd",
      "major": 6
    },
    "vue": {
      "package": "ant-design-vue",
      "major": 4
    },
    "html": {
      "via": "cdn-react",
      "runnable": "paste-and-run — React + antd loaded from a CDN, no build step"
    }
  },
  "props": [
    {
      "name": "options",
      "type": "{ label, value }[]",
      "default": "[]",
      "desc": "The selectable set"
    },
    {
      "name": "value",
      "type": "string | string[]",
      "default": "—",
      "desc": "Selected value(s); array when mode=multiple"
    },
    {
      "name": "showSearch",
      "type": "boolean",
      "default": "true",
      "desc": "Type to filter options"
    },
    {
      "name": "mode",
      "type": "single | multiple | tags",
      "default": "single",
      "desc": "Selection cardinality"
    },
    {
      "name": "size",
      "type": "small | default | large",
      "default": "default",
      "desc": "Control height 24 / 32 / 40"
    },
    {
      "name": "status",
      "type": "error | warning",
      "default": "—",
      "desc": "Validation border colour"
    },
    {
      "name": "allowClear",
      "type": "boolean",
      "default": "false",
      "desc": "Show an × to clear the selection"
    },
    {
      "name": "disabled",
      "type": "boolean",
      "default": "false",
      "desc": "Non-interactive, muted control"
    },
    {
      "name": "loading",
      "type": "boolean",
      "default": "false",
      "desc": "Spinner while async options load"
    },
    {
      "name": "placeholder",
      "type": "string",
      "default": "—",
      "desc": "Hint shown when empty"
    },
    {
      "name": "onChange",
      "type": "(value) => void",
      "default": "—",
      "desc": "Fires with the new selection"
    }
  ],
  "tokens": [
    "colorPrimary",
    "borderRadius",
    "controlHeight",
    "colorBorder",
    "Select.optionSelectedBg",
    "Select.optionActiveBg"
  ],
  "spec": [
    {
      "label": "Control",
      "value": "height 32 · radius 8 · 1px #E3E3E3 border"
    },
    {
      "label": "Search",
      "value": "showSearch — type to filter options"
    },
    {
      "label": "Focus",
      "value": "brand #6A1EBB border"
    },
    {
      "label": "Selected option",
      "value": "brand-tint #F9F5FF row, #6A1EBB label"
    },
    {
      "label": "Placeholder",
      "value": "#8A8A8A"
    },
    {
      "label": "Size",
      "value": "small 24 · default 32 · large 40"
    },
    {
      "label": "Status",
      "value": "error #F5222D · warning #FAAD14 border"
    }
  ],
  "opinion": {
    "whenToUse": [
      {
        "what": "Select",
        "when": "one value from a known set of more than ~5 options — don't make the user type it"
      },
      {
        "what": "Radio",
        "when": "2–5 mutually-exclusive options all worth showing at once"
      },
      {
        "what": "Input",
        "when": "free text that isn't a known set"
      }
    ],
    "note": "Pre-select the recommended default rather than leaving it empty. Keep option labels short and sentence case; for long lists keep showSearch on. For a short, known set (or a select inside a shadow-DOM surface like a settings row) reach for the leaf Select field (slug `select-field`, <aha-select>) instead — this composite is for search / tags / multi / virtualised lists.",
    "dsv3": "COVERED — antd v6 Select themed by selectTheme; matrix: size (small 24 / default 32 / large 40) × status (—/error #F5222D/warning #FAAD14) × mode (single/multiple/tags) × allowClear · disabled · loading, plus showSearch and placeholder. Verified via Figma search_design_system against the DS V3 Select set (Select, Form-Item/Select, Form-Item/Select-Multiple, Input-Addon/Select-Single) on fileKey MwjvUjVI0HnfwD9EwPXRAy. Not yet exposed: prefix/suffix adornments and option groups (optGroup) — real follow-up."
  },
  "surfaces": [
    "editor",
    "dashboard",
    "settings"
  ],
  "snippets": {
    "html": "<!-- Paste-and-run: save as .html and open in a browser. No build step, no bundler.\n     Select is a COMPOSITE (antd, no framework-free element), so its HTML form is a\n     CDN-React page — React + antd load from a CDN (esm.sh) and mount on open. It\n     consumes the SAME shared `selectTheme` the React/Vue wrappers use, so it renders\n     the DS V3 look (32px control, radius 8, #E3E3E3 border, brand-tint selected option).\n     No JSX here (JSX needs a compiler) — we use React.createElement via the `h` alias. -->\n<div id=\"root\"></div>\n<script type=\"module\">\n  import React from 'https://esm.sh/react@18';\n  import { createRoot } from 'https://esm.sh/react-dom@18/client';\n  import { ConfigProvider, Select } from 'https://esm.sh/antd@6?deps=react@18,react-dom@18';\n  import { selectTheme } from 'https://cdn.jsdelivr.net/gh/ahaslides-product/ahaslides-design@master/lib/select-theme.js';\n\n  const h = React.createElement;\n\n  const options = [\n    { value: 'poll',      label: 'Poll' },\n    { value: 'quiz',      label: 'Quiz' },\n    { value: 'wordcloud', label: 'Word cloud' },\n    { value: 'qa',        label: 'Q&A' },\n  ];\n\n  // Same shared theme the React/Vue wrappers pass to ConfigProvider.\n  // The DS V3 matrix is just props: size ('small'|'default'|'large'),\n  // status ('error'|'warning'), mode ('multiple'|'tags'), allowClear, loading, disabled.\n  createRoot(document.getElementById('root')).render(\n    h(ConfigProvider, { theme: selectTheme },\n      h(Select, {\n        showSearch: true,\n        size: 'default',        // 'small' | 'default' | 'large' → 24 / 32 / 40\n        mode: 'multiple',       // omit for single; 'multiple' | 'tags'\n        allowClear: true,\n        placeholder: 'Choose a slide type',\n        options,\n        style: { width: 240 },\n      })\n    )\n  );\n</script>\n",
    "react": "import { ConfigProvider, Select } from 'antd';   // antd v6\nimport { selectTheme } from '@ahaslides-product/design/select-theme';\n\nconst options = [\n  { value: 'poll',      label: 'Poll' },\n  { value: 'quiz',      label: 'Quiz' },\n  { value: 'wordcloud', label: 'Word cloud' },\n  { value: 'qa',        label: 'Q&A' },\n];\n\n<ConfigProvider theme={selectTheme}>\n  <Select\n    showSearch\n    size=\"default\"                          // small | default | large → 24 / 32 / 40\n    status={error ? 'error' : undefined}    // 'error' | 'warning' for validation\n    mode=\"multiple\"                         // omit for single; 'multiple' | 'tags'\n    allowClear                              // × to clear the selection\n    loading={fetching}                      // spinner while async options load\n    disabled={locked}\n    placeholder=\"Choose a slide type\"\n    options={options}\n    value={type}\n    onChange={setType}\n    style={{ width: 240 }}\n  />\n</ConfigProvider>\n// One shared selectTheme → the DS V3 look; never restyle a bare <Select> per call site.\n",
    "vue": "<script setup>\nimport { ref } from 'vue';\nimport { ConfigProvider, Select } from 'ant-design-vue';   // ant-design-vue v4\nimport { selectTheme } from '@ahaslides-product/design/select-theme';\n\nconst type = ref('poll');\nconst options = [\n  { value: 'poll',      label: 'Poll' },\n  { value: 'quiz',      label: 'Quiz' },\n  { value: 'wordcloud', label: 'Word cloud' },\n  { value: 'qa',        label: 'Q&A' },\n];\n</script>\n\n<template>\n  <a-config-provider :theme=\"selectTheme\">\n    <a-select\n      v-model:value=\"type\"\n      show-search\n      size=\"default\"                       <!-- small | large → 24 / 40 -->\n      :status=\"error ? 'error' : ''\"       <!-- 'error' | 'warning' -->\n      mode=\"multiple\"                      <!-- omit for single; 'multiple' | 'tags' -->\n      allow-clear\n      :loading=\"fetching\"\n      :disabled=\"locked\"\n      placeholder=\"Choose a slide type\"\n      :options=\"options\"\n      style=\"width: 240px\"\n    />\n  </a-config-provider>\n</template>\n<!-- The SAME selectTheme as React → one DS V3 look across both vendor libraries. -->\n",
    "theme": "// @ahaslides-product/design/select-theme — declared ONCE, consumed by both tiers.\nimport { selectTheme } from '@ahaslides-product/design/select-theme';\n\nexport const selectTheme = {\n  token: {\n    colorPrimary: '#6A1EBB',\n    borderRadius: 8,\n    controlHeight: 32,\n    colorBorder: '#E3E3E3',            // 1px rest border\n    colorTextPlaceholder: '#8A8A8A',\n    fontFamily: 'var(--aha-font-product, \"Plus Jakarta Sans\", sans-serif)',\n  },\n  components: {\n    Select: {\n      optionSelectedBg: '#F9F5FF',     // brand-tint selected row\n      optionSelectedColor: '#6A1EBB',\n      optionActiveBg: '#F7F7F7',       // keyboard/hover row\n      borderRadius: 8,\n      controlHeight: 32,\n    },\n  },\n};\n"
  }
}
