---
title: "Combobox"
description: "Combobox component - searchable dropdown with keyboard navigation."
slug: "combobox"
---

import { DocPage, PageHeader, SkillPanel, Example, ExampleLabel, ExampleHint, ExampleCode, SourceFiles, SourceNote, StatesSection, CodeBlock, Demo, DemoCode, ChangelogEntries, ArchBody, StatsClaim, StatsCards, PageOverlay, DocText, DocLink, H2, SkillField, SkillText, SkillRow, SkillGrid, Variant, ApiPill, Dim, CodeCard, TableCard, ApiSection } from "../../lib/components/index";

<DocPage meta={meta}>

<PageHeader slug="combobox" title="Combobox" component="combobox">
  A searchable select triggered by an outline button. Opens a popover with a search input and a scrollable list of options. Keyboard navigable via <code>aria-activedescendant</code>. Uses the <code>popover</code> API for top-layer rendering.
</PageHeader>

<SkillPanel component="combobox">
  <SkillField label="Native basis">
<SkillText>Button trigger + <code>popover</code> popup containing a search input and <code>role="listbox"</code>.</SkillText>
  </SkillField>

  <SkillField label="Web Platform APIs">
<SkillRow>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API" title="top-layer rendering and light-dismiss for the dropdown list"><code>Popover API</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning" title="positions the popover relative to the trigger without JS"><code>CSS Anchor Positioning</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style" title="entry animation starting values for popover appearance"><code>@starting-style</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior" title="prevents scroll chaining from the listbox to the page"><code>overscroll-behavior</code></ApiPill>
    <ApiPill href="https://developer.mozilla.org/en-US/docs/Web/CSS/:has" title="reveals the injected clear button exactly while a selection exists"><code>:has()</code></ApiPill>
    <ApiPill href="https://www.w3.org/WAI/ARIA/apg/patterns/combobox/" title="keyboard navigation and screen reader contract"><code>WAI-ARIA Combobox pattern</code></ApiPill>
  </SkillRow>
  </SkillField>

  <SkillField label="Classes">
<SkillRow>
    <code>.combobox</code>
    <code>.combobox-trigger</code>
    <code>.combobox-value</code>
    <code>.combobox-chevron</code>
    <code>.combobox-clear</code>
    <code>.combobox-content</code>
    <code>.combobox-search</code>
    <code>.combobox-search-icon</code>
    <code>.combobox-search-input</code>
    <code>.combobox-listbox</code>
    <code>.combobox-item</code>
    <code>.combobox-empty</code>
    <code>.combobox-group-label</code>
    <code>.combobox-separator</code>
  </SkillRow>
  </SkillField>

  <SkillField label="Data attributes">
<SkillText dense>• <code>data-placeholder</code> - on <code>.combobox-value</code>; present when showing placeholder text, removed on selection</SkillText>
  <SkillText dense>• <code>data-highlighted</code> - on <code>.combobox-item</code>; JS-managed, set on the currently keyboard-highlighted option</SkillText>
  <SkillText>• <code>data-value</code> - on <code>.combobox-item</code>; the programmatic value of the option (used by JS, not CSS)</SkillText>
  </SkillField>

  <SkillField label="Keyboard">
<SkillGrid>
    <Variant name="Key" description="Behavior" />
    <Variant name="ArrowDown" description="Highlight next item" />
    <Variant name="ArrowUp" description="Highlight previous item" />
    <Variant name="Home" description="Highlight first visible item" />
    <Variant name="End" description="Highlight last visible item" />
    <Variant name="Enter" description="Select highlighted item, close popup" />
    <Variant name="Escape" description="Close popup, return focus to trigger" />
    <Variant name="Tab" description="Close popup, move focus to next element" />
    <Variant name="Typing" description="Filter items, auto-highlight first match" />
  </SkillGrid>
  </SkillField>

  <SkillField label="Notes">
<SkillText dense>• The trigger is a <code>.btn\[data-variant="outline"\]</code> - styled by the button system</SkillText>
  <SkillText dense>• When the popover opens, focus moves to the search input inside</SkillText>
  <SkillText dense>• When the popover closes, focus returns to the trigger button</SkillText>
  <SkillText dense>• Use <code>aria-activedescendant</code> to communicate the highlighted item to screen readers</SkillText>
  <SkillText dense>• The <code>popover</code> attribute enables top-layer rendering and light-dismiss</SkillText>
  <SkillText dense>• CSS anchor positioning places the popover below the trigger; no JS positioning needed</SkillText>
  <SkillText dense>• The popover animates in via <code>@starting-style</code> + <code>transition-behavior: allow-discrete</code></SkillText>
  <SkillText dense>• The check icon for selected items uses a CSS <code>::before</code> pseudo-element</SkillText>
  <SkillText dense>• Filter matching is case-insensitive and supports substring matching</SkillText>
  <SkillText dense>• A clear (✕) button is injected on the trigger once a value is selected, replacing the chevron; clicking it restores the placeholder</SkillText>
  <SkillText dense>• Group labels and separators auto-hide when their group has no visible items</SkillText>
  <SkillText dense>• <code>overscroll-behavior: contain</code> prevents scroll chaining from the listbox</SkillText>
  <SkillText dense>• <code>prefers-reduced-motion: reduce</code> disables all transitions</SkillText>
  <p class="text-muted-foreground m-0">• <code>forced-colors: active</code> supports Windows High Contrast Mode</p>
  </SkillField>
</SkillPanel>

```html example label="Basic Combobox" hint="An outline button opens a popover with a search field and selectable options. Click the trigger or use keyboard to interact." height="24"
<div class="combobox" style="width: 14rem">
  <label class="label" id="cb-framework-label">Framework</label>
  <button
    class="btn combobox-trigger"
    data-variant="outline"
    aria-haspopup="listbox"
    aria-expanded="false"
    aria-labelledby="cb-framework-label"
    aria-controls="cb-framework-popover"
  >
    <span class="combobox-value" data-placeholder="Select framework...">Select framework...</span>
    <svg
      class="combobox-chevron"
      aria-hidden="true"
      width="16"
      height="16"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      stroke-width="2"
    >
      <path d="m7 15 5 5 5-5"></path>
      <path d="m7 9 5-5 5 5"></path>
    </svg>
  </button>
  <div id="cb-framework-popover" class="combobox-content" popover>
    <div class="combobox-search">
      <svg
        class="combobox-search-icon"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <circle cx="11" cy="11" r="8"></circle>
        <path d="m21 21-4.3-4.3"></path>
      </svg>
      <input
        class="combobox-search-input"
        type="text"
        role="combobox"
        autocomplete="off"
        aria-expanded="true"
        aria-controls="cb-framework-listbox"
        aria-activedescendant
        aria-autocomplete="list"
        placeholder="Search..."
      />
    </div>
    <div id="cb-framework-listbox" role="listbox" class="combobox-listbox" aria-label="Frameworks">
      <div class="combobox-empty" hidden>No results found.</div>
      <div role="option" id="cb-opt-next" class="combobox-item" data-value="nextjs" aria-selected="false">Next.js</div>
      <div role="option" id="cb-opt-svelte" class="combobox-item" data-value="sveltekit" aria-selected="false"
        >SvelteKit</div
      >
      <div role="option" id="cb-opt-nuxt" class="combobox-item" data-value="nuxt" aria-selected="false">Nuxt</div>
      <div role="option" id="cb-opt-remix" class="combobox-item" data-value="remix" aria-selected="false">Remix</div>
      <div role="option" id="cb-opt-astro" class="combobox-item" data-value="astro" aria-selected="false">Astro</div>
    </div>
  </div>
</div>
```

```html example label="Grouped with Disabled Items" hint="Combobox with option groups, visual separators, and a disabled option. Use .combobox-group-label for headings and aria-disabled='true' to disable individual items." height="24"
<div class="combobox" style="width: 14rem">
  <label class="label" id="cb-timezone-label">Timezone</label>
  <button
    class="btn combobox-trigger"
    data-variant="outline"
    aria-haspopup="listbox"
    aria-expanded="false"
    aria-labelledby="cb-timezone-label"
    aria-controls="cb-timezone-popover"
  >
    <span class="combobox-value" data-placeholder="Select timezone...">Select timezone...</span>
    <svg
      class="combobox-chevron"
      aria-hidden="true"
      width="16"
      height="16"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      stroke-width="2"
    >
      <path d="m7 15 5 5 5-5"></path>
      <path d="m7 9 5-5 5 5"></path>
    </svg>
  </button>
  <div id="cb-timezone-popover" class="combobox-content" popover>
    <div class="combobox-search">
      <svg
        class="combobox-search-icon"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <circle cx="11" cy="11" r="8"></circle>
        <path d="m21 21-4.3-4.3"></path>
      </svg>
      <input
        class="combobox-search-input"
        type="text"
        role="combobox"
        autocomplete="off"
        aria-expanded="true"
        aria-controls="cb-timezone-listbox"
        aria-activedescendant
        aria-autocomplete="list"
        placeholder="Search..."
      />
    </div>
    <div id="cb-timezone-listbox" role="listbox" class="combobox-listbox" aria-label="Timezones">
      <div class="combobox-empty" hidden>No results found.</div>
      <div class="combobox-group-label">North America</div>
      <div role="option" id="cb-tz-est" class="combobox-item" data-value="est" aria-selected="false">Eastern (EST)</div>
      <div role="option" id="cb-tz-cst" class="combobox-item" data-value="cst" aria-selected="false">Central (CST)</div>
      <div role="option" id="cb-tz-pst" class="combobox-item" data-value="pst" aria-selected="false">Pacific (PST)</div>
      <div class="combobox-separator"></div>
      <div class="combobox-group-label">Europe</div>
      <div role="option" id="cb-tz-gmt" class="combobox-item" data-value="gmt" aria-selected="false">GMT (London)</div>
      <div role="option" id="cb-tz-cet" class="combobox-item" data-value="cet" aria-selected="false">CET (Berlin)</div>
      <div
        role="option"
        id="cb-tz-eet"
        class="combobox-item"
        data-value="eet"
        aria-selected="false"
        aria-disabled="true"
        >EET (Bucharest)</div
      >
    </div>
  </div>
</div>
```

```html example label="Disabled" hint="Disable the trigger button to prevent interaction." height="24"
<div class="combobox" style="width: 14rem">
  <label class="label" id="cb-disabled-label">Framework</label>
  <button
    class="btn combobox-trigger"
    data-variant="outline"
    disabled
    aria-haspopup="listbox"
    aria-expanded="false"
    aria-labelledby="cb-disabled-label"
    aria-controls="cb-disabled-popover"
  >
    <span class="combobox-value" data-placeholder="Select framework...">Select framework...</span>
    <svg
      class="combobox-chevron"
      aria-hidden="true"
      width="16"
      height="16"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      stroke-width="2"
    >
      <path d="m7 15 5 5 5-5"></path>
      <path d="m7 9 5-5 5 5"></path>
    </svg>
  </button>
  <div id="cb-disabled-popover" class="combobox-content" popover>
    <div class="combobox-search">
      <svg
        class="combobox-search-icon"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <circle cx="11" cy="11" r="8"></circle>
        <path d="m21 21-4.3-4.3"></path>
      </svg>
      <input
        class="combobox-search-input"
        type="text"
        role="combobox"
        autocomplete="off"
        aria-expanded="true"
        aria-controls="cb-disabled-listbox"
        aria-activedescendant
        aria-autocomplete="list"
        placeholder="Search..."
      />
    </div>
    <div id="cb-disabled-listbox" role="listbox" class="combobox-listbox" aria-label="Frameworks">
      <div class="combobox-empty" hidden>No results found.</div>
      <div role="option" id="cb-dis-next" class="combobox-item" data-value="nextjs" aria-selected="false">Next.js</div>
      <div role="option" id="cb-dis-svelte" class="combobox-item" data-value="sveltekit" aria-selected="false"
        >SvelteKit</div
      >
    </div>
  </div>
</div>
```

```html example label="Multi-select" hint="data-multiple on the .combobox picks several options: a click or Enter toggles an option and the list stays open, each option shows a checkbox (the listbox is aria-multiselectable), and the choices appear as removable tags under the trigger. Backspace in the empty search removes the last tag; the clear button empties all. data-name renders one hidden input per value, so the form submits every tag; each change fires combobox:change { values, labels }." height="30"
<form onsubmit="event.preventDefault()" style="width: 18rem">
  <div class="combobox" data-multiple data-name="tags" id="post-tags">
    <label class="label" id="post-tags-label">Tags</label>
    <button
      type="button"
      class="btn combobox-trigger"
      data-variant="outline"
      aria-haspopup="listbox"
      aria-expanded="false"
      aria-labelledby="post-tags-label"
      aria-controls="post-tags-popover"
    >
      <span class="combobox-value" data-placeholder="Add tags...">Add tags...</span>
      <svg
        class="combobox-chevron"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <path d="m7 15 5 5 5-5"></path>
        <path d="m7 9 5-5 5 5"></path>
      </svg>
    </button>
    <div id="post-tags-popover" class="combobox-content" popover>
      <div class="combobox-search">
        <svg
          class="combobox-search-icon"
          aria-hidden="true"
          width="16"
          height="16"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
        >
          <circle cx="11" cy="11" r="8"></circle>
          <path d="m21 21-4.3-4.3"></path>
        </svg>
        <input
          class="combobox-search-input"
          type="text"
          role="combobox"
          autocomplete="off"
          aria-expanded="true"
          aria-controls="post-tags-listbox"
          aria-activedescendant
          aria-autocomplete="list"
          placeholder="Search tags..."
        />
      </div>
      <div id="post-tags-listbox" role="listbox" class="combobox-listbox" aria-label="Tags">
        <div class="combobox-empty" hidden>No tags found.</div>
        <div role="option" id="post-tag-design" class="combobox-item" data-value="design" aria-selected="true"
          >Design</div
        >
        <div role="option" id="post-tag-engineering" class="combobox-item" data-value="engineering" aria-selected="true"
          >Engineering</div
        >
        <div
          role="option"
          id="post-tag-accessibility"
          class="combobox-item"
          data-value="accessibility"
          aria-selected="false"
          >Accessibility</div
        >
        <div
          role="option"
          id="post-tag-performance"
          class="combobox-item"
          data-value="performance"
          aria-selected="false"
          >Performance</div
        >
        <div role="option" id="post-tag-release" class="combobox-item" data-value="release" aria-selected="false"
          >Release notes</div
        >
        <div role="option" id="post-tag-tutorial" class="combobox-item" data-value="tutorial" aria-selected="false"
          >Tutorial</div
        >
        <div role="option" id="post-tag-case-study" class="combobox-item" data-value="case-study" aria-selected="false"
          >Case study</div
        >
      </div>
    </div>
  </div>
  <p class="text-sm text-muted-foreground" style="margin: 0.75rem 0 0"
    >Submits <code id="post-tags-out">tags=design&amp;tags=engineering</code></p
  >
</form>
<script>
  document.getElementById('post-tags').addEventListener('combobox:change', (e) => {
    const q = e.detail.values.map((v) => 'tags=' + v).join('&');
    document.getElementById('post-tags-out').textContent = q || '(nothing)';
  });
</script>
```

```html example label="Tag input" hint="data-tags puts the tags INSIDE the field and you type right there: the list opens and filters as you type. Enter (or a comma) picks the exact match - case doesn't matter - or, with data-creatable, creates a new tag from what you typed (the 'Create …' row). Arrow keys pick any other listed option instead. Backspace in the empty field removes the last tag, Escape closes the list. Created tags become options too; data-name submits every tag." height="30"
<form onsubmit="event.preventDefault()" style="width: 22rem">
  <div class="combobox" data-multiple data-tags data-creatable data-name="topics" id="post-topics">
    <label class="label" for="post-topics-input">Topics</label>
    <div class="combobox-field">
      <input
        class="combobox-field-input"
        id="post-topics-input"
        type="text"
        role="combobox"
        autocomplete="off"
        aria-expanded="false"
        aria-controls="post-topics-list"
        aria-autocomplete="list"
        placeholder="Type a topic..."
      />
    </div>
    <div id="post-topics-popover" class="combobox-content" popover="manual">
      <div id="post-topics-list" role="listbox" class="combobox-listbox" aria-label="Topics">
        <div class="combobox-empty" hidden>No topics found.</div>
        <div role="option" id="topic-css" class="combobox-item" data-value="css" aria-selected="true">CSS</div>
        <div role="option" id="topic-html" class="combobox-item" data-value="html" aria-selected="true">HTML</div>
        <div role="option" id="topic-javascript" class="combobox-item" data-value="javascript" aria-selected="false"
          >JavaScript</div
        >
        <div role="option" id="topic-typescript" class="combobox-item" data-value="typescript" aria-selected="false"
          >TypeScript</div
        >
        <div
          role="option"
          id="topic-accessibility"
          class="combobox-item"
          data-value="accessibility"
          aria-selected="false"
          >Accessibility</div
        >
        <div role="option" id="topic-performance" class="combobox-item" data-value="performance" aria-selected="false"
          >Performance</div
        >
        <div
          role="option"
          id="topic-design-systems"
          class="combobox-item"
          data-value="design-systems"
          aria-selected="false"
          >Design systems</div
        >
      </div>
    </div>
  </div>
  <p class="text-sm text-muted-foreground" style="margin: 0.75rem 0 0"
    >Submits <code id="post-topics-out">topics=css&amp;topics=html</code><span id="post-topics-created"></span
  ></p>
</form>
<script>
  document.getElementById('post-topics').addEventListener('combobox:change', (e) => {
    const q = e.detail.values.map((v) => 'topics=' + encodeURIComponent(v)).join('&');
    document.getElementById('post-topics-out').textContent = q || '(nothing)';
    if (e.detail.created)
      document.getElementById('post-topics-created').textContent = ' · created "' + e.detail.created + '"';
  });
</script>
```

```html example label="Sizes" hint="Set data-size on the .combobox wrapper; trigger and list rows scale together - the default equals the .btn md step." height="24"
<div class="flex items-center gap-4 mb-3">
  <span class="demo-label demo-label-w5">Extra small</span>
  <div class="combobox flex-1" data-size="xs" style="max-width: 12rem"
    ><button
      class="btn combobox-trigger"
      data-variant="outline"
      aria-haspopup="listbox"
      aria-expanded="false"
      aria-controls="sz-cb-xs"
      ><span class="combobox-value" data-placeholder="Select…">Select…</span
      ><svg
        class="combobox-chevron"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <path d="m7 15 5 5 5-5"></path>
        <path d="m7 9 5-5 5 5"></path></svg></button
    ><div id="sz-cb-xs" class="combobox-content" popover
      ><div class="combobox-search"><input class="combobox-search-input" type="text" placeholder="Search..." /></div
      ><div class="combobox-listbox" role="listbox"
        ><div class="combobox-empty" hidden>No results found.</div
        ><div role="option" class="combobox-item" aria-selected="false">Alpha</div
        ><div role="option" class="combobox-item" aria-selected="false">Beta</div></div
      ></div
    ></div
  >
</div>
<div class="flex items-center gap-4 mb-3">
  <span class="demo-label demo-label-w5">Small</span>
  <div class="combobox flex-1" data-size="sm" style="max-width: 12rem"
    ><button
      class="btn combobox-trigger"
      data-variant="outline"
      aria-haspopup="listbox"
      aria-expanded="false"
      aria-controls="sz-cb-sm"
      ><span class="combobox-value" data-placeholder="Select…">Select…</span
      ><svg
        class="combobox-chevron"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <path d="m7 15 5 5 5-5"></path>
        <path d="m7 9 5-5 5 5"></path></svg></button
    ><div id="sz-cb-sm" class="combobox-content" popover
      ><div class="combobox-search"><input class="combobox-search-input" type="text" placeholder="Search..." /></div
      ><div class="combobox-listbox" role="listbox"
        ><div class="combobox-empty" hidden>No results found.</div
        ><div role="option" class="combobox-item" aria-selected="false">Alpha</div
        ><div role="option" class="combobox-item" aria-selected="false">Beta</div></div
      ></div
    ></div
  >
</div>
<div class="flex items-center gap-4 mb-3">
  <span class="demo-label demo-label-w5">Medium</span>
  <div class="combobox flex-1" data-size="md" style="max-width: 12rem"
    ><button
      class="btn combobox-trigger"
      data-variant="outline"
      aria-haspopup="listbox"
      aria-expanded="false"
      aria-controls="sz-cb-md"
      ><span class="combobox-value" data-placeholder="Select…">Select…</span
      ><svg
        class="combobox-chevron"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <path d="m7 15 5 5 5-5"></path>
        <path d="m7 9 5-5 5 5"></path></svg></button
    ><div id="sz-cb-md" class="combobox-content" popover
      ><div class="combobox-search"><input class="combobox-search-input" type="text" placeholder="Search..." /></div
      ><div class="combobox-listbox" role="listbox"
        ><div class="combobox-empty" hidden>No results found.</div
        ><div role="option" class="combobox-item" aria-selected="false">Alpha</div
        ><div role="option" class="combobox-item" aria-selected="false">Beta</div></div
      ></div
    ></div
  >
</div>
<div class="flex items-center gap-4 mb-3">
  <span class="demo-label demo-label-w5">Large</span>
  <div class="combobox flex-1" data-size="lg" style="max-width: 12rem"
    ><button
      class="btn combobox-trigger"
      data-variant="outline"
      aria-haspopup="listbox"
      aria-expanded="false"
      aria-controls="sz-cb-lg"
      ><span class="combobox-value" data-placeholder="Select…">Select…</span
      ><svg
        class="combobox-chevron"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <path d="m7 15 5 5 5-5"></path>
        <path d="m7 9 5-5 5 5"></path></svg></button
    ><div id="sz-cb-lg" class="combobox-content" popover
      ><div class="combobox-search"><input class="combobox-search-input" type="text" placeholder="Search..." /></div
      ><div class="combobox-listbox" role="listbox"
        ><div class="combobox-empty" hidden>No results found.</div
        ><div role="option" class="combobox-item" aria-selected="false">Alpha</div
        ><div role="option" class="combobox-item" aria-selected="false">Beta</div></div
      ></div
    ></div
  >
</div>
<div class="flex items-center gap-4 mb-3">
  <span class="demo-label demo-label-w5">Extra large</span>
  <div class="combobox flex-1" data-size="xl" style="max-width: 12rem"
    ><button
      class="btn combobox-trigger"
      data-variant="outline"
      aria-haspopup="listbox"
      aria-expanded="false"
      aria-controls="sz-cb-xl"
      ><span class="combobox-value" data-placeholder="Select…">Select…</span
      ><svg
        class="combobox-chevron"
        aria-hidden="true"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
      >
        <path d="m7 15 5 5 5-5"></path>
        <path d="m7 9 5-5 5 5"></path></svg></button
    ><div id="sz-cb-xl" class="combobox-content" popover
      ><div class="combobox-search"><input class="combobox-search-input" type="text" placeholder="Search..." /></div
      ><div class="combobox-listbox" role="listbox"
        ><div class="combobox-empty" hidden>No results found.</div
        ><div role="option" class="combobox-item" aria-selected="false">Alpha</div
        ><div role="option" class="combobox-item" aria-selected="false">Beta</div></div
      ></div
    ></div
  >
</div>
```

<StatesSection>
  <p class="text-sm text-muted-foreground m-0 mb-3">Named states via the shared State API, driven per instance through the bound <code>api</code>:</p>
  <ul class="text-sm text-muted-foreground m-0 mb-3 ps-5">
    <li><code>default</code> - closed (the authored state; the trigger toggles it)</li>
    <li><code>open</code> - listbox shown via <code>showPopover()</code> with the search input focused; <code>getState().config.value</code> reports the selected option</li>
  </ul>
  <p class="text-sm text-muted-foreground">The demo element carries <code>data-state-demo</code>; <code>bun run screenshots</code> drives it via <code>el.api.setState(name)</code> and captures <code>screenshots/\{mode\}/combobox-\{state\}.png</code>.</p>

Machine contract - verified against <a class="link" href="../schemas/combobox.schema.json"><code>combobox.schema.json</code></a> by <code>bun run verify</code>:

```states
| State | Type | Values | Default | Description |
| --- | --- | --- | --- | --- |
| `open` | `boolean` | `true`, `false` | `false` | Listbox shown - runtime `_open()` highlights the first option and anchors the panel. |
```

</StatesSection>

<ApiSection component="combobox" />

<SourceFiles component="combobox" section="css" />

<SourceFiles component="combobox" section="js">
  <SourceNote for="js">Trigger opens/closes the popover. Search input filters the list. Arrow keys navigate, Enter selects, Escape closes. Focus moves to search input on open and back to trigger on close.</SourceNote>
</SourceFiles>

</DocPage>
