---
title: "Combobox"
description: "Autocomplete input with a list of suggestions."
component: true
---

```tsx
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"

type Framework = {
  value: string
  label: string
}

const frameworks: Framework[] = [
  { value: "solid", label: "Solid" },
  { value: "svelte", label: "Svelte" },
  { value: "vue", label: "Vue" },
  { value: "react", label: "React" },
  { value: "astro", label: "Astro" }
]

export default function ComboboxDemo() {
  return (
    <Combobox<Framework>
      itemToLabel={(option) => String(option["label"])}
      itemToValue={(option) => String(option["value"])}
    >
      <ComboboxInput
        class="w-full max-w-sm"
        placeholder="Select a framework"
        aria-label="Select a framework"
      />
      <ComboboxContent>
        <ComboboxList>
          <For each={frameworks}>
            {(option) => (
              <ComboboxItem value={option} label={option["label"]}>
                {option.label}
              </ComboboxItem>
            )}
          </For>
        </ComboboxList>
        <ComboboxEmpty>No framework found.</ComboboxEmpty>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Installation

<CodeTabs>

<TabsList>
  <TabsTrigger value="cli">Command</TabsTrigger>
  <TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>

<TabsContent value="cli">

```bash
npx solidui-cli@latest add combobox
```

</TabsContent>

<TabsContent value="manual">

<Steps class="mb-0 pt-2">

<Step>Install the following dependencies:</Step>

```bash
npm install @ui-sdk/solid @ui-sdk/core
```

<Step>Install the required Solid UI dependencies:</Step>

```bash
npx solidui-cli@latest add button input-group
```

<Step>Copy and paste the following code into your project.</Step>

```tsx title="components/ui/combobox.tsx"
// Inline SVG icons from Lucide (https://lucide.dev), ISC License, Copyright (c) Lucide Icons and Contributors.
import type { ComponentProps, JSX } from "@solidjs/web"
import {
  Combobox as SdkCombobox,
  ComboboxInput as SdkComboboxInput,
  ComboboxTrigger as SdkComboboxTrigger,
  ComboboxContent as SdkComboboxContent,
  ComboboxList as SdkComboboxList,
  ComboboxItem as SdkComboboxItem,
  ComboboxItemIndicator as SdkComboboxItemIndicator,
  ComboboxItemText as SdkComboboxItemText,
  ComboboxGroup as SdkComboboxGroup,
  ComboboxGroupLabel as SdkComboboxGroupLabel,
  ComboboxEmpty as SdkComboboxEmpty,
  ComboboxClear as SdkComboboxClear,
  ComboboxChips as SdkComboboxChips,
  ComboboxChip as SdkComboboxChip,
  ComboboxChipRemove as SdkComboboxChipRemove,
  ComboboxValue as SdkComboboxValue,
  ComboboxSeparator as SdkComboboxSeparator
} from "@ui-sdk/solid/combobox"
import { omit, Show } from "solid-js"

import { cn } from "~/lib/utils"
import {
  InputGroup,
  InputGroupAddon,
  InputGroupButton
} from "~/components/ui/input-group"
const Combobox = SdkCombobox
const ComboboxValue = SdkComboboxValue
type ComboboxInputProps = Omit<
  ComponentProps<typeof SdkComboboxInput>,
  "class"
> & {
  class?: string
  children?: JSX.Element
  showTrigger?: boolean
  showClear?: boolean
}
const ComboboxInput = (props: ComboboxInputProps) => {
  const rest = omit(props, "class", "children", "showTrigger", "showClear")
  return (
    <InputGroup class={cn("w-auto", props.class)}>
      <SdkComboboxInput
        {...rest}
        data-ui="input-group-control"
        class={cn(
          "h-8 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent w-full min-w-0 flex-1 outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50"
        )}
      />
      <InputGroupAddon align="inline-end">
        <Show when={props.showTrigger !== false}>
          <ComboboxTrigger
            disabled={props.disabled}
            class="group-has-data-[slot=combobox-clear]/input-group:hidden"
          />
        </Show>
        <Show when={props.showClear}>
          <ComboboxClear disabled={props.disabled} />
        </Show>
      </InputGroupAddon>
      {props.children}
    </InputGroup>
  )
}
const ComboboxTrigger = (
  props: Omit<
    ComponentProps<typeof SdkComboboxTrigger>,
    "class" | "children"
  > & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxTrigger
    aria-label="Show options"
    render={(partProps) => (
      <InputGroupButton {...partProps} size="icon-xs" variant="ghost" />
    )}
    {...props}
    class={cn("[&_svg:not([class*='size-'])]:size-4", props.class)}
  >
    {props.children ?? (
      <svg
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        class="size-4 text-muted-foreground pointer-events-none"
      >
        <path d="m6 9 6 6 6-6" />
      </svg>
    )}
  </SdkComboboxTrigger>
)
const ComboboxClear = (
  props: Omit<ComponentProps<typeof SdkComboboxClear>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxClear
    aria-label="Clear selection"
    render={(partProps) => (
      <InputGroupButton {...partProps} size="icon-xs" variant="ghost" />
    )}
    {...props}
    class={cn("", props.class)}
  >
    <svg
      width="24"
      height="24"
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      stroke-width="2"
      stroke-linecap="round"
      stroke-linejoin="round"
      aria-hidden="true"
      class="pointer-events-none"
    >
      <path d="M18 6 6 18" />
      <path d="m6 6 12 12" />
    </svg>
  </SdkComboboxClear>
)
const ComboboxContent = (
  props: Omit<
    ComponentProps<typeof SdkComboboxContent>,
    "class" | "children"
  > & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxContent
    sideOffset={6}
    align="start"
    {...props}
    class={cn(
      "max-h-72 min-w-36 overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 group/combobox-content relative z-50 max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) [[data-slot=combobox-chips]~&]:min-w-(--anchor-width)",
      props.class
    )}
  />
)
const ComboboxList = (
  props: Omit<ComponentProps<typeof SdkComboboxList>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxList
    {...props}
    class={cn(
      "no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 group-has-[[data-slot=combobox-empty][data-empty]]/combobox-content:p-0 overflow-y-auto overscroll-contain",
      props.class
    )}
  />
)
const ComboboxItem = (
  props: Omit<ComponentProps<typeof SdkComboboxItem>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxItem
    {...props}
    class={cn(
      "gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
      props.class
    )}
  >
    {props.children}
    <SdkComboboxItemIndicator class="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
      <svg
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        class="pointer-events-none"
      >
        <path d="M20 6 9 17l-5-5" />
      </svg>
    </SdkComboboxItemIndicator>
  </SdkComboboxItem>
)
const ComboboxItemText = SdkComboboxItemText
const ComboboxGroup = (
  props: Omit<ComponentProps<typeof SdkComboboxGroup>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxGroup {...props} class={cn("", props.class)} />
)
const ComboboxLabel = (
  props: Omit<
    ComponentProps<typeof SdkComboboxGroupLabel>,
    "class" | "children"
  > & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxGroupLabel
    {...props}
    class={cn("px-2 py-1.5 text-xs text-muted-foreground", props.class)}
  />
)
const ComboboxEmpty = (
  props: Omit<ComponentProps<typeof SdkComboboxEmpty>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxEmpty {...props} class={cn("hidden w-full justify-center py-2 text-center text-sm text-muted-foreground data-empty:flex", props.class)} />
)
const ComboboxSeparator = (
  props: Omit<
    ComponentProps<typeof SdkComboboxSeparator>,
    "class" | "children"
  > & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxSeparator
    {...props}
    class={cn("-mx-1 my-1 h-px bg-border", props.class)}
  />
)
const ComboboxChips = (
  props: Omit<ComponentProps<typeof SdkComboboxChips>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxChips
    render={InputGroup}
    {...props}
    class={cn("flex min-h-8 flex-wrap items-center gap-1 rounded-lg border border-input bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1 dark:bg-input/30 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40 flex-wrap", props.class)}
  />
)
const ComboboxChip = (
  props: Omit<ComponentProps<typeof SdkComboboxChip>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => <SdkComboboxChip {...props} class={cn("flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs font-medium whitespace-nowrap text-foreground has-data-[slot=combobox-chip-remove]:pr-0", props.class)} />
const ComboboxChipRemove = (
  props: Omit<
    ComponentProps<typeof SdkComboboxChipRemove>,
    "class" | "children"
  > & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxChipRemove
    aria-label="Remove selection"
    {...props}
    class={cn("-ml-1 opacity-50 hover:opacity-100", props.class)}
  >
    {props.children ?? (
      <svg
        width="24"
        height="24"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        class=""
      >
        <path d="M18 6 6 18" />
        <path d="m6 6 12 12" />
      </svg>
    )}
  </SdkComboboxChipRemove>
)
const ComboboxChipInput = (
  props: Omit<ComponentProps<typeof SdkComboboxInput>, "class" | "children"> & {
    class?: string
    children?: JSX.Element
  }
) => (
  <SdkComboboxInput
    data-ui="input-group-control"
    {...props}
    class={cn(
      "min-w-24 flex-1 outline-none placeholder:text-muted-foreground",
      props.class
    )}
  />
)
export {
  Combobox,
  ComboboxValue,
  ComboboxInput,
  ComboboxTrigger,
  ComboboxClear,
  ComboboxContent,
  ComboboxList,
  ComboboxItem,
  ComboboxItemText,
  ComboboxGroup,
  ComboboxLabel,
  ComboboxEmpty,
  ComboboxSeparator,
  ComboboxChips,
  ComboboxChip,
  ComboboxChipRemove,
  ComboboxChipInput
}
```

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsContent>

</CodeTabs>

## Usage

```tsx
import {
  Combobox,
  ComboboxContent,
  ComboboxInput,
  ComboboxItem,
  ComboboxList,
  ComboboxEmpty
} from "~/components/ui/combobox"

;<Combobox>
  <ComboboxInput
    aria-label="Framework"
    placeholder="Select a framework"
    showClear
  />
  <ComboboxContent>
    <ComboboxList>
      <ComboboxItem value="solid">Solid</ComboboxItem>
      <ComboboxItem value="astro">Astro</ComboboxItem>
    </ComboboxList>
    <ComboboxEmpty>No framework found.</ComboboxEmpty>
  </ComboboxContent>
</Combobox>
```

Use `value` and `onValueChange` for selection, and `query` and `onQueryChange` for controlled search text. Set `autoHighlight="always"` to highlight an option as the list opens. Object values use `itemToValue` and `itemToLabel`. Multiple selection uses `multiple`, `ComboboxChips`, `ComboboxValue`, `ComboboxChip`, and `ComboboxChipRemove`.

## Composition

### Simple

A single-line input and a flat list (see [Basic](#basic)).

```text
Combobox
├── ComboboxInput
└── ComboboxContent
    ├── ComboboxEmpty
    └── ComboboxList
        ├── ComboboxItem
        └── ComboboxItem
```

### With chips

Multi-select with `multiple`, chips, and a chips input (see [Multiple](#multiple)).

```text
Combobox
├── ComboboxChips
│   ├── ComboboxValue
│   │   └── ComboboxChip
│   │       └── ComboboxChipRemove
│   └── ComboboxChipInput
└── ComboboxContent
    ├── ComboboxEmpty
    └── ComboboxList
        ├── ComboboxItem
        └── ComboboxItem
```

### With groups

Render items inside each `ComboboxGroup` and use a separator between groups (see [Groups](#groups)).

```text
Combobox
├── ComboboxInput
└── ComboboxContent
    ├── ComboboxEmpty
    └── ComboboxList
        ├── ComboboxGroup
        │   ├── ComboboxLabel
        │   ├── ComboboxItem
        │   └── ComboboxItem
        ├── ComboboxSeparator
        └── ComboboxGroup
            ├── ComboboxLabel
            ├── ComboboxItem
            └── ComboboxItem
```

## Basic

A simple combobox with a list of frameworks.

```tsx
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"

const frameworks = [
  "Next.js",
  "SvelteKit",
  "Nuxt.js",
  "Remix",
  "Astro"
] as const

export default function ComboboxBasic() {
  return (
    <Combobox<string>>
      <ComboboxInput
        placeholder="Select a framework"
        aria-label="Select a framework"
      />
      <ComboboxContent>
        <ComboboxEmpty>No items found.</ComboboxEmpty>
        <ComboboxList>
          <For each={frameworks}>
            {(item) => <ComboboxItem value={item}>{item}</ComboboxItem>}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Multiple

Use `multiple` and `ComboboxChips` to select more than one option and show each selection as a chip.

```tsx
import { For } from "solid-js"

import { ComboboxValue, ComboboxChips } from "~/components/ui/combobox"
import {
  Combobox,
  ComboboxChip,
  ComboboxChipInput,
  ComboboxChipRemove,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"

const frameworks = [
  "Next.js",
  "SvelteKit",
  "Nuxt.js",
  "Remix",
  "Astro"
] as const

export default function ComboboxMultiple() {
  return (
    <Combobox<string, true>
      multiple
      autoHighlight
      defaultValue={[frameworks[0]]}
    >
      <ComboboxChips class="w-full max-w-xs">
        <ComboboxValue>
          {(state) => (
            <>
              <For each={state.value as string[]}>
                {(option) => (
                  <ComboboxChip value={option}>
                    {option}
                    <ComboboxChipRemove aria-label={`Remove ${option}`} />
                  </ComboboxChip>
                )}
              </For>
            </>
          )}
        </ComboboxValue>
        <ComboboxChipInput
          aria-label="Frameworks"
          class="min-w-24"
          placeholder="Add a framework"
        />
      </ComboboxChips>
      <ComboboxContent>
        <ComboboxList>
          <For each={frameworks}>
            {(option) => (
              <ComboboxItem value={option} label={option}>
                {option}
              </ComboboxItem>
            )}
          </For>
        </ComboboxList>
        <ComboboxEmpty>No items found.</ComboboxEmpty>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Clear Button

Use `showClear` on `ComboboxInput` to show a clear button.

```tsx
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"

const frameworks = [
  "Next.js",
  "SvelteKit",
  "Nuxt.js",
  "Remix",
  "Astro"
] as const

export default function ComboboxWithClear() {
  return (
    <Combobox<string> defaultValue={frameworks[0]}>
      <ComboboxInput
        placeholder="Select a framework"
        aria-label="Select a framework"
        showClear
      />
      <ComboboxContent>
        <ComboboxEmpty>No items found.</ComboboxEmpty>
        <ComboboxList>
          <For each={frameworks}>
            {(item) => <ComboboxItem value={item}>{item}</ComboboxItem>}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Groups

Use `ComboboxGroup` and `ComboboxSeparator` to group items.

```tsx
import { For, Show } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxGroup,
  ComboboxInput,
  ComboboxItem,
  ComboboxLabel,
  ComboboxList,
  ComboboxSeparator
} from "~/components/ui/combobox"

const timezones = [
  {
    value: "Americas",
    items: [
      "(GMT-5) New York",
      "(GMT-8) Los Angeles",
      "(GMT-6) Chicago",
      "(GMT-5) Toronto",
      "(GMT-8) Vancouver",
      "(GMT-3) São Paulo"
    ]
  },
  {
    value: "Europe",
    items: [
      "(GMT+0) London",
      "(GMT+1) Paris",
      "(GMT+1) Berlin",
      "(GMT+1) Rome",
      "(GMT+1) Madrid",
      "(GMT+1) Amsterdam"
    ]
  },
  {
    value: "Asia/Pacific",
    items: [
      "(GMT+9) Tokyo",
      "(GMT+8) Shanghai",
      "(GMT+8) Singapore",
      "(GMT+4) Dubai",
      "(GMT+11) Sydney",
      "(GMT+9) Seoul"
    ]
  }
] as const

export default function ComboboxWithGroupsAndSeparator() {
  return (
    <Combobox<string>>
      <ComboboxInput
        placeholder="Select a timezone"
        aria-label="Select a timezone"
      />
      <ComboboxContent>
        <ComboboxEmpty>No timezones found.</ComboboxEmpty>
        <ComboboxList>
          <For each={timezones}>
            {(group, index) => (
              <>
                <Show when={index() !== 0}>
                  <ComboboxSeparator />
                </Show>
                <ComboboxGroup>
                  <ComboboxLabel>{group.value}</ComboboxLabel>
                  <For each={group.items}>
                    {(item) => <ComboboxItem value={item}>{item}</ComboboxItem>}
                  </For>
                </ComboboxGroup>
              </>
            )}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Custom Items

Render a custom component inside `ComboboxItem`. For object values, pass `itemToValue` and `itemToLabel` to `Combobox`.

```tsx
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"
import {
  Item,
  ItemContent,
  ItemDescription,
  ItemTitle
} from "~/components/ui/item"

const countries = [
  { code: "", value: "", continent: "", label: "Select country" },
  {
    code: "ar",
    value: "argentina",
    label: "Argentina",
    continent: "South America"
  },
  { code: "au", value: "australia", label: "Australia", continent: "Oceania" },
  { code: "br", value: "brazil", label: "Brazil", continent: "South America" },
  { code: "ca", value: "canada", label: "Canada", continent: "North America" },
  { code: "cn", value: "china", label: "China", continent: "Asia" },
  {
    code: "co",
    value: "colombia",
    label: "Colombia",
    continent: "South America"
  },
  { code: "eg", value: "egypt", label: "Egypt", continent: "Africa" },
  { code: "fr", value: "france", label: "France", continent: "Europe" },
  { code: "de", value: "germany", label: "Germany", continent: "Europe" },
  { code: "it", value: "italy", label: "Italy", continent: "Europe" },
  { code: "jp", value: "japan", label: "Japan", continent: "Asia" },
  { code: "ke", value: "kenya", label: "Kenya", continent: "Africa" },
  { code: "mx", value: "mexico", label: "Mexico", continent: "North America" },
  {
    code: "nz",
    value: "new-zealand",
    label: "New Zealand",
    continent: "Oceania"
  },
  { code: "ng", value: "nigeria", label: "Nigeria", continent: "Africa" },
  {
    code: "za",
    value: "south-africa",
    label: "South Africa",
    continent: "Africa"
  },
  { code: "kr", value: "south-korea", label: "South Korea", continent: "Asia" },
  {
    code: "gb",
    value: "united-kingdom",
    label: "United Kingdom",
    continent: "Europe"
  },
  {
    code: "us",
    value: "united-states",
    label: "United States",
    continent: "North America"
  }
]

export default function ComboboxWithCustomItems() {
  return (
    <Combobox<(typeof countries)[number]>
      itemToLabel={(country) => country.label}
      itemToValue={(country) => country.value}
    >
      <ComboboxInput
        placeholder="Search countries..."
        aria-label="Search countries"
      />
      <ComboboxContent>
        <ComboboxEmpty>No countries found.</ComboboxEmpty>
        <ComboboxList>
          <For each={countries.filter((country) => country.code !== "")}>
            {(country) => (
              <ComboboxItem value={country} label={country.label}>
                <Item size="xs" class="p-0">
                  <ItemContent>
                    <ItemTitle class="whitespace-nowrap">
                      {country.label}
                    </ItemTitle>
                    <ItemDescription>
                      {country.continent} ({country.code})
                    </ItemDescription>
                  </ItemContent>
                </Item>
              </ComboboxItem>
            )}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Invalid

Set `aria-invalid` on `ComboboxInput` to show the invalid state.

```tsx
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"

const frameworks = [
  "Next.js",
  "SvelteKit",
  "Nuxt.js",
  "Remix",
  "Astro"
] as const

export default function ComboboxInvalid() {
  return (
    <Combobox<string>>
      <ComboboxInput
        placeholder="Select a framework"
        aria-label="Select a framework"
        aria-invalid="true"
      />
      <ComboboxContent>
        <ComboboxEmpty>No items found.</ComboboxEmpty>
        <ComboboxList>
          <For each={frameworks}>
            {(item) => <ComboboxItem value={item}>{item}</ComboboxItem>}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Disabled

Set `disabled` on `ComboboxInput` to disable the input.

```tsx
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"

const frameworks = [
  "Next.js",
  "SvelteKit",
  "Nuxt.js",
  "Remix",
  "Astro"
] as const

export default function ComboboxDisabled() {
  return (
    <Combobox<string>>
      <ComboboxInput
        placeholder="Select a framework"
        aria-label="Select a framework"
        disabled
      />
      <ComboboxContent>
        <ComboboxEmpty>No items found.</ComboboxEmpty>
        <ComboboxList>
          <For each={frameworks}>
            {(item) => <ComboboxItem value={item}>{item}</ComboboxItem>}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Auto Highlight

Use the `autoHighlight` prop to automatically highlight the first item on filter.

```tsx
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList
} from "~/components/ui/combobox"

const frameworks = [
  "Next.js",
  "SvelteKit",
  "Nuxt.js",
  "Remix",
  "Astro"
] as const

export default function ComboboxAutoHighlight() {
  return (
    <Combobox<string> autoHighlight>
      <ComboboxInput
        placeholder="Select a framework"
        aria-label="Select a framework"
      />
      <ComboboxContent>
        <ComboboxEmpty>No items found.</ComboboxEmpty>
        <ComboboxList>
          <For each={frameworks}>
            {(item) => <ComboboxItem value={item}>{item}</ComboboxItem>}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## Popup

Use the `render` prop on `ComboboxTrigger` to open the popup from a button. Put `ComboboxInput` inside `ComboboxContent` to search within the popup.

```tsx
import { For } from "solid-js"

import { Button } from "~/components/ui/button"
import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList,
  ComboboxTrigger,
  ComboboxValue
} from "~/components/ui/combobox"

const countries = [
  { code: "", value: "", continent: "", label: "Select country" },
  {
    code: "ar",
    value: "argentina",
    label: "Argentina",
    continent: "South America"
  },
  { code: "au", value: "australia", label: "Australia", continent: "Oceania" },
  { code: "br", value: "brazil", label: "Brazil", continent: "South America" },
  { code: "ca", value: "canada", label: "Canada", continent: "North America" },
  { code: "cn", value: "china", label: "China", continent: "Asia" },
  {
    code: "co",
    value: "colombia",
    label: "Colombia",
    continent: "South America"
  },
  { code: "eg", value: "egypt", label: "Egypt", continent: "Africa" },
  { code: "fr", value: "france", label: "France", continent: "Europe" },
  { code: "de", value: "germany", label: "Germany", continent: "Europe" },
  { code: "it", value: "italy", label: "Italy", continent: "Europe" },
  { code: "jp", value: "japan", label: "Japan", continent: "Asia" },
  { code: "ke", value: "kenya", label: "Kenya", continent: "Africa" },
  { code: "mx", value: "mexico", label: "Mexico", continent: "North America" },
  {
    code: "nz",
    value: "new-zealand",
    label: "New Zealand",
    continent: "Oceania"
  },
  { code: "ng", value: "nigeria", label: "Nigeria", continent: "Africa" },
  {
    code: "za",
    value: "south-africa",
    label: "South Africa",
    continent: "Africa"
  },
  { code: "kr", value: "south-korea", label: "South Korea", continent: "Asia" },
  {
    code: "gb",
    value: "united-kingdom",
    label: "United Kingdom",
    continent: "Europe"
  },
  {
    code: "us",
    value: "united-states",
    label: "United States",
    continent: "North America"
  }
]

export default function ComboboxPopup() {
  return (
    <>
      <Combobox<(typeof countries)[number]>
        itemToLabel={(country) => country.label}
        itemToValue={(country) => country.value}
        defaultValue={countries[0]!}
      >
        <ComboboxTrigger
          render={(part) => (
            <Button
              {...part}
              variant="outline"
              class="w-64 justify-between font-normal"
            />
          )}
        >
          <ComboboxValue />
        </ComboboxTrigger>
        <ComboboxContent>
          <ComboboxInput
            showTrigger={false}
            placeholder="Search"
            aria-label="Search"
          />
          <ComboboxEmpty>No items found.</ComboboxEmpty>
          <ComboboxList>
            <For each={countries.filter((country) => country.code !== "")}>
              {(item) => (
                <ComboboxItem value={item} label={item.label}>
                  {item.label}
                </ComboboxItem>
              )}
            </For>
          </ComboboxList>
        </ComboboxContent>
      </Combobox>
    </>
  )
}
```

## Input Group

Put an `InputGroupAddon` inside `ComboboxInput` to add an icon alongside the search field.

```tsx
// Inline SVG icons from Lucide (https://lucide.dev), ISC License, Copyright (c) Lucide Icons and Contributors.
import { For } from "solid-js"

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxGroup,
  ComboboxInput,
  ComboboxItem,
  ComboboxLabel,
  ComboboxList
} from "~/components/ui/combobox"
import { InputGroupAddon } from "~/components/ui/input-group"

const timezones = [
  {
    value: "Americas",
    items: [
      "(GMT-5) New York",
      "(GMT-8) Los Angeles",
      "(GMT-6) Chicago",
      "(GMT-5) Toronto",
      "(GMT-8) Vancouver",
      "(GMT-3) São Paulo"
    ]
  },
  {
    value: "Europe",
    items: [
      "(GMT+0) London",
      "(GMT+1) Paris",
      "(GMT+1) Berlin",
      "(GMT+1) Rome",
      "(GMT+1) Madrid",
      "(GMT+1) Amsterdam"
    ]
  },
  {
    value: "Asia/Pacific",
    items: [
      "(GMT+9) Tokyo",
      "(GMT+8) Shanghai",
      "(GMT+8) Singapore",
      "(GMT+4) Dubai",
      "(GMT+11) Sydney",
      "(GMT+9) Seoul"
    ]
  }
] as const

export default function ComboxboxInputGroup() {
  return (
    <Combobox<string>>
      <ComboboxInput
        placeholder="Select a timezone"
        aria-label="Select a timezone"
      >
        <InputGroupAddon>
          <svg
            width="24"
            height="24"
            viewBox="0 0 24 24"
            fill="none"
            stroke="currentColor"
            stroke-width="2"
            stroke-linecap="round"
            stroke-linejoin="round"
            aria-hidden="true"
          >
            <circle cx="12" cy="12" r="10" />
            <path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
            <path d="M2 12h20" />
          </svg>
        </InputGroupAddon>
      </ComboboxInput>
      <ComboboxContent alignOffset={-28} class="w-60">
        <ComboboxEmpty>No timezones found.</ComboboxEmpty>
        <ComboboxList>
          <For each={timezones}>
            {(group) => (
              <ComboboxGroup>
                <ComboboxLabel>{group.value}</ComboboxLabel>
                <For each={group.items}>
                  {(item) => <ComboboxItem value={item}>{item}</ComboboxItem>}
                </For>
              </ComboboxGroup>
            )}
          </For>
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}
```

## API Reference

See the [UI SDK Combobox API](https://ui-sdk.dev/docs/solid/components/combobox) for selection, filtering, and keyboard behavior.
