Skip to content
UI

Combobox

An input component that combines a text input with a listbox, allowing users to filter a list of options.

<script setup lang="ts">
import { ref } from 'vue'
import { createListCollection } from '@destyler-ui/vue'
import { Combobox } from '@destyler-ui/vue'

const frameworks = createListCollection({
  items: [
    { label: 'React', value: 'react' },
    { label: 'Solid', value: 'solid' },
    { label: 'Vue', value: 'vue' },
    { label: 'Svelte', value: 'svelte', disabled: true },
  ],
})
const testProps = ref<string[]>([])
</script>

<template>
  <Combobox.Root :collection="frameworks" v-model="testProps">
    <Combobox.Label>Framework</Combobox.Label>
    <Combobox.Control>
      <Combobox.Input data-testid="input" />
      <Combobox.Trigger data-testid="trigger">Open</Combobox.Trigger>
      <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
    </Combobox.Control>
    <Teleport to="body">
      <Combobox.Positioner data-testid="positioner">
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            <Combobox.Item v-for="item in frameworks.items" :key="item.value" :item="item">
              <Combobox.ItemText>{{ item.label }}</Combobox.ItemText>
              <Combobox.ItemIndicator></Combobox.ItemIndicator>
            </Combobox.Item>
          </Combobox.ItemGroup>
          <Combobox.List />
        </Combobox.Content>
      </Combobox.Positioner>
    </Teleport>
  </Combobox.Root>
</template>
import { useState } from 'react'
import { createListCollection } from '@destyler-ui/react'
import { Combobox } from '@destyler-ui/react'

const collection = createListCollection({
  items: [
    { label: 'React', value: 'react' },
    { label: 'Solid', value: 'solid' },
    { label: 'Vue', value: 'vue' },
    { label: 'Svelte', value: 'svelte', disabled: true },
  ],
})

interface BasicProps {
  disabled?: boolean
  multiple?: boolean
  onValueChange?: (details: { value: string[] }) => void
  onOpenChange?: (details: { open: boolean }) => void
  readOnly?: boolean
  lazyMount?: boolean
  unmountOnExit?: boolean
}

export function Basic(props: BasicProps) {
  const [value, setValue] = useState<string[]>([])

  const handleValueChange = (details: { value: string[] }) => {
    setValue(details.value)
    props.onValueChange?.(details)
  }

  return (
    <Combobox.Root
      collection={collection}
      value={value}
      onValueChange={handleValueChange}
      onOpenChange={props.onOpenChange}
      disabled={props.disabled}
      readOnly={props.readOnly}
      lazyMount={props.lazyMount}
      unmountOnExit={props.unmountOnExit}
    >
      <Combobox.Label>Framework</Combobox.Label>
      <Combobox.Control>
        <Combobox.Input data-testid="input" />
        <Combobox.Trigger data-testid="trigger">Open</Combobox.Trigger>
        <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
      </Combobox.Control>
      <Combobox.Positioner data-testid="positioner">
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            {collection.items.map(item => (
              <Combobox.Item key={item.value} item={item}>
                <Combobox.ItemText>{item.label}</Combobox.ItemText>
                <Combobox.ItemIndicator></Combobox.ItemIndicator>
              </Combobox.Item>
            ))}
          </Combobox.ItemGroup>
          <Combobox.List />
        </Combobox.Content>
      </Combobox.Positioner>
    </Combobox.Root>
  )
}
import { Combobox, createListCollection } from '@destyler-ui/solid/combobox'
import { createMemo, createSignal, For } from 'solid-js'
import { Portal } from 'solid-js/web'

const initialItems = ['React', 'Solid', 'Vue']

export function Basic() {
  const [items, setItems] = createSignal(initialItems)

  const collection = createMemo(() => createListCollection({ items: items() }))

  const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
    setItems(
      initialItems.filter(item => item.toLowerCase().includes(details.inputValue.toLowerCase())),
    )
  }

  return (
    <Combobox.Root collection={collection()} onInputValueChange={handleInputChange}>
      <Combobox.Label>Framework</Combobox.Label>
      <Combobox.Control>
        <Combobox.Input />
        <Combobox.Trigger>Open</Combobox.Trigger>
        <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
      </Combobox.Control>
      <Portal>
        <Combobox.Positioner>
          <Combobox.Content>
            <Combobox.ItemGroup>
              <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
              <For each={collection().items}>
                {item => (
                  <Combobox.Item item={item}>
                    <Combobox.ItemText>{item}</Combobox.ItemText>
                    <Combobox.ItemIndicator></Combobox.ItemIndicator>
                  </Combobox.Item>
                )}
              </For>
            </Combobox.ItemGroup>
          </Combobox.Content>
        </Combobox.Positioner>
      </Portal>
    </Combobox.Root>
  )
}
<script module lang="ts">
  import type { ComboboxOpenChangeDetails, ComboboxValueChangeDetails } from '@destyler-ui/svelte'

  export interface BasicProps {
    disabled?: boolean
    multiple?: boolean
    onValueChange?: (details: ComboboxValueChangeDetails) => void
    onOpenChange?: (details: ComboboxOpenChangeDetails) => void
    readOnly?: boolean
    lazyMount?: boolean
    unmountOnExit?: boolean
  }
</script>

<script lang="ts">
  import { Combobox, createListCollection } from '@destyler-ui/svelte'

  const collection = createListCollection({
    items: [
      { label: 'React', value: 'react' },
      { label: 'Solid', value: 'solid' },
      { label: 'Vue', value: 'vue' },
      { label: 'Svelte', value: 'svelte', disabled: true },
    ],
  })

  let { onOpenChange, onValueChange, ...props }: BasicProps = $props()
  let value = $state<string[]>([])
</script>

<Combobox.Root {collection} bind:value {onOpenChange} {onValueChange} {...props}>
  <Combobox.Label>Framework</Combobox.Label>
  <Combobox.Control>
    <Combobox.Input data-testid="input" />
    <Combobox.Trigger data-testid="trigger">Open</Combobox.Trigger>
    <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
  </Combobox.Control>
  <Combobox.Positioner data-testid="positioner">
    <Combobox.Content>
      <Combobox.ItemGroup>
        <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
        {#each collection.items as item (item.value)}
          <Combobox.Item {item}>
            <Combobox.ItemText>{item.label}</Combobox.ItemText>
            <Combobox.ItemIndicator></Combobox.ItemIndicator>
          </Combobox.Item>
        {/each}
      </Combobox.ItemGroup>
      <Combobox.List />
    </Combobox.Content>
  </Combobox.Positioner>
</Combobox.Root>
<script setup lang="ts">
import { Combobox } from '@destyler-ui/vue'
</script>
<template>
<Combobox.Root>
<Combobox.Label />
<Combobox.Control>
<Combobox.Input />
<Combobox.Trigger />
<Combobox.ClearTrigger />
</Combobox.Control>
<Combobox.Positioner>
<Combobox.Content>
<Combobox.ItemGroup>
<Combobox.ItemGroupLabel />
<Combobox.Item>
<Combobox.ItemText />
<Combobox.ItemIndicator />
</Combobox.Item>
</Combobox.ItemGroup>
</Combobox.Content>
</Combobox.Positioner>
</Combobox.Root>
</template>
import { Combobox } from '@destyler-ui/react'
export default function Basic() {
return (
<Combobox.Root>
<Combobox.Label />
<Combobox.Control>
<Combobox.Input />
<Combobox.Trigger />
<Combobox.ClearTrigger />
</Combobox.Control>
<Combobox.Positioner>
<Combobox.Content>
<Combobox.ItemGroup>
<Combobox.ItemGroupLabel />
<Combobox.Item>
<Combobox.ItemText />
<Combobox.ItemIndicator />
</Combobox.Item>
</Combobox.ItemGroup>
</Combobox.Content>
</Combobox.Positioner>
</Combobox.Root>
)
}
import { Combobox, createListCollection } from '@destyler-ui/solid'
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
export default function Basic() {
return (
<Combobox.Root collection={collection}>
<Combobox.Label>Framework</Combobox.Label>
<Combobox.Control>
<Combobox.Input />
<Combobox.Trigger />
<Combobox.ClearTrigger />
</Combobox.Control>
<Combobox.Positioner>
<Combobox.Content>
<Combobox.ItemGroup>
<Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
<Combobox.Item item={collection.items[0]}>
<Combobox.ItemText>{collection.items[0]}</Combobox.ItemText>
<Combobox.ItemIndicator />
</Combobox.Item>
</Combobox.ItemGroup>
</Combobox.Content>
</Combobox.Positioner>
</Combobox.Root>
)
}
<script module lang="ts">
import type { ComboboxOpenChangeDetails, ComboboxValueChangeDetails } from '@destyler-ui/svelte'
export interface BasicProps {
disabled?: boolean
multiple?: boolean
onValueChange?: (details: ComboboxValueChangeDetails) => void
onOpenChange?: (details: ComboboxOpenChangeDetails) => void
readOnly?: boolean
lazyMount?: boolean
unmountOnExit?: boolean
}
</script>
<script lang="ts">
import { Combobox, createListCollection } from '@destyler-ui/svelte'
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Solid', value: 'solid' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte', disabled: true },
],
})
let { onOpenChange, onValueChange, ...props }: BasicProps = $props()
let value = $state<string[]>([])
</script>
<Combobox.Root {collection} bind:value {onOpenChange} {onValueChange} {...props}>
<Combobox.Label>Framework</Combobox.Label>
<Combobox.Control>
<Combobox.Input data-testid="input" />
<Combobox.Trigger data-testid="trigger">Open</Combobox.Trigger>
<Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
</Combobox.Control>
<Combobox.Positioner data-testid="positioner">
<Combobox.Content>
<Combobox.ItemGroup>
<Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
{#each collection.items as item (item.value)}
<Combobox.Item {item}>
<Combobox.ItemText>{item.label}</Combobox.ItemText>
<Combobox.ItemIndicator></Combobox.ItemIndicator>
</Combobox.Item>
{/each}
</Combobox.ItemGroup>
<Combobox.List />
</Combobox.Content>
</Combobox.Positioner>
</Combobox.Root>
<script setup lang="ts">
import { ref } from 'vue'
import { createListCollection } from '@destyler-ui/vue'
import { Combobox } from '@destyler-ui/vue'

const frameworks = createListCollection({
  items: [
    { label: 'React', value: 'react' },
    { label: 'Solid', value: 'solid' },
    { label: 'Vue', value: 'vue' },
    { label: 'Svelte', value: 'svelte', disabled: true },
  ],
})
const testProps = ref<string[]>([])
</script>

<template>
  <Combobox.Root :collection="frameworks" v-model="testProps">
    <Combobox.Label>Framework</Combobox.Label>
    <Combobox.Control>
      <Combobox.Input data-testid="input" />
      <Combobox.Trigger data-testid="trigger">Open</Combobox.Trigger>
      <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
    </Combobox.Control>
    <Teleport to="body">
      <Combobox.Positioner data-testid="positioner">
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            <Combobox.Item v-for="item in frameworks.items" :key="item.value" :item="item">
              <Combobox.ItemText>{{ item.label }}</Combobox.ItemText>
              <Combobox.ItemIndicator></Combobox.ItemIndicator>
            </Combobox.Item>
          </Combobox.ItemGroup>
          <Combobox.List />
        </Combobox.Content>
      </Combobox.Positioner>
    </Teleport>
  </Combobox.Root>
</template>
import { useState } from 'react'
import { createListCollection } from '@destyler-ui/react'
import { Combobox } from '@destyler-ui/react'

const collection = createListCollection({
  items: [
    { label: 'React', value: 'react' },
    { label: 'Solid', value: 'solid' },
    { label: 'Vue', value: 'vue' },
    { label: 'Svelte', value: 'svelte', disabled: true },
  ],
})

interface BasicProps {
  disabled?: boolean
  multiple?: boolean
  onValueChange?: (details: { value: string[] }) => void
  onOpenChange?: (details: { open: boolean }) => void
  readOnly?: boolean
  lazyMount?: boolean
  unmountOnExit?: boolean
}

export function Basic(props: BasicProps) {
  const [value, setValue] = useState<string[]>([])

  const handleValueChange = (details: { value: string[] }) => {
    setValue(details.value)
    props.onValueChange?.(details)
  }

  return (
    <Combobox.Root
      collection={collection}
      value={value}
      onValueChange={handleValueChange}
      onOpenChange={props.onOpenChange}
      disabled={props.disabled}
      readOnly={props.readOnly}
      lazyMount={props.lazyMount}
      unmountOnExit={props.unmountOnExit}
    >
      <Combobox.Label>Framework</Combobox.Label>
      <Combobox.Control>
        <Combobox.Input data-testid="input" />
        <Combobox.Trigger data-testid="trigger">Open</Combobox.Trigger>
        <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
      </Combobox.Control>
      <Combobox.Positioner data-testid="positioner">
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            {collection.items.map(item => (
              <Combobox.Item key={item.value} item={item}>
                <Combobox.ItemText>{item.label}</Combobox.ItemText>
                <Combobox.ItemIndicator></Combobox.ItemIndicator>
              </Combobox.Item>
            ))}
          </Combobox.ItemGroup>
          <Combobox.List />
        </Combobox.Content>
      </Combobox.Positioner>
    </Combobox.Root>
  )
}
import { Combobox, createListCollection } from '@destyler-ui/solid/combobox'
import { createMemo, createSignal, For } from 'solid-js'
import { Portal } from 'solid-js/web'

const initialItems = ['React', 'Solid', 'Vue']

export function Basic() {
  const [items, setItems] = createSignal(initialItems)

  const collection = createMemo(() => createListCollection({ items: items() }))

  const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
    setItems(
      initialItems.filter(item => item.toLowerCase().includes(details.inputValue.toLowerCase())),
    )
  }

  return (
    <Combobox.Root collection={collection()} onInputValueChange={handleInputChange}>
      <Combobox.Label>Framework</Combobox.Label>
      <Combobox.Control>
        <Combobox.Input />
        <Combobox.Trigger>Open</Combobox.Trigger>
        <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
      </Combobox.Control>
      <Portal>
        <Combobox.Positioner>
          <Combobox.Content>
            <Combobox.ItemGroup>
              <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
              <For each={collection().items}>
                {item => (
                  <Combobox.Item item={item}>
                    <Combobox.ItemText>{item}</Combobox.ItemText>
                    <Combobox.ItemIndicator></Combobox.ItemIndicator>
                  </Combobox.Item>
                )}
              </For>
            </Combobox.ItemGroup>
          </Combobox.Content>
        </Combobox.Positioner>
      </Portal>
    </Combobox.Root>
  )
}
<script module lang="ts">
  import type { ComboboxOpenChangeDetails, ComboboxValueChangeDetails } from '@destyler-ui/svelte'

  export interface BasicProps {
    disabled?: boolean
    multiple?: boolean
    onValueChange?: (details: ComboboxValueChangeDetails) => void
    onOpenChange?: (details: ComboboxOpenChangeDetails) => void
    readOnly?: boolean
    lazyMount?: boolean
    unmountOnExit?: boolean
  }
</script>

<script lang="ts">
  import { Combobox, createListCollection } from '@destyler-ui/svelte'

  const collection = createListCollection({
    items: [
      { label: 'React', value: 'react' },
      { label: 'Solid', value: 'solid' },
      { label: 'Vue', value: 'vue' },
      { label: 'Svelte', value: 'svelte', disabled: true },
    ],
  })

  let { onOpenChange, onValueChange, ...props }: BasicProps = $props()
  let value = $state<string[]>([])
</script>

<Combobox.Root {collection} bind:value {onOpenChange} {onValueChange} {...props}>
  <Combobox.Label>Framework</Combobox.Label>
  <Combobox.Control>
    <Combobox.Input data-testid="input" />
    <Combobox.Trigger data-testid="trigger">Open</Combobox.Trigger>
    <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
  </Combobox.Control>
  <Combobox.Positioner data-testid="positioner">
    <Combobox.Content>
      <Combobox.ItemGroup>
        <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
        {#each collection.items as item (item.value)}
          <Combobox.Item {item}>
            <Combobox.ItemText>{item.label}</Combobox.ItemText>
            <Combobox.ItemIndicator></Combobox.ItemIndicator>
          </Combobox.Item>
        {/each}
      </Combobox.ItemGroup>
      <Combobox.List />
    </Combobox.Content>
  </Combobox.Positioner>
</Combobox.Root>

Advanced usage with custom filtering and item rendering.

<script setup lang="ts">
import { createListCollection, Combobox } from '@destyler-ui/vue'

const frameworks = createListCollection({
  items: [
    { label: 'React', value: 'react' },
    { label: 'Solid', value: 'solid' },
    { label: 'Vue', value: 'vue' },
    { label: 'Svelte', value: 'svelte', disabled: true },
  ],
})
</script>

<template>
  <Combobox.Root :collection="frameworks" multiple>
    <Combobox.Label>Framework</Combobox.Label>
    <Combobox.Control>
      <Combobox.Input />
      <Combobox.Trigger>Open</Combobox.Trigger>
      <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
    </Combobox.Control>
    <Teleport to="body">
      <Combobox.Positioner>
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            <Combobox.Item v-for="item in frameworks.items" :key="item.value" :item="item">
              <Combobox.ItemText>{{ item.label }}</Combobox.ItemText>
              <Combobox.ItemIndicator></Combobox.ItemIndicator>
            </Combobox.Item>
          </Combobox.ItemGroup>
        </Combobox.Content>
      </Combobox.Positioner>
    </Teleport>
  </Combobox.Root>
</template>
import { createListCollection } from '@destyler-ui/react'
import { Combobox } from '@destyler-ui/react'

const collection = createListCollection({
  items: [
    { label: 'React', value: 'react' },
    { label: 'Solid', value: 'solid' },
    { label: 'Vue', value: 'vue' },
    { label: 'Svelte', value: 'svelte', disabled: true },
  ],
})

export function Advanced() {
  return (
    <Combobox.Root collection={collection} multiple>
      <Combobox.Label>Framework</Combobox.Label>
      <Combobox.Control>
        <Combobox.Input />
        <Combobox.Trigger>Open</Combobox.Trigger>
        <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
      </Combobox.Control>
      <Combobox.Positioner>
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            {collection.items.map(item => (
              <Combobox.Item key={item.value} item={item}>
                <Combobox.ItemText>{item.label}</Combobox.ItemText>
                <Combobox.ItemIndicator></Combobox.ItemIndicator>
              </Combobox.Item>
            ))}
          </Combobox.ItemGroup>
          <Combobox.List />
        </Combobox.Content>
      </Combobox.Positioner>
    </Combobox.Root>
  )
}
import { Combobox, createListCollection } from '@destyler-ui/solid/combobox'
import { For } from 'solid-js'
import { Portal } from 'solid-js/web'

export function Advanced() {
  const collection = createListCollection({
    items: [
      { label: 'React', value: 'react' },
      { label: 'Solid', value: 'solid' },
      { label: 'Vue', value: 'vue' },
      { label: 'Svelte', value: 'svelte', disabled: true },
    ],
  })
  return (
    <Combobox.Root collection={collection}>
      <Combobox.Label>Framework</Combobox.Label>
      <Combobox.Control>
        <Combobox.Input />
        <Combobox.Trigger>Open</Combobox.Trigger>
        <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
      </Combobox.Control>
      <Portal>
        <Combobox.Positioner>
          <Combobox.Content>
            <Combobox.ItemGroup>
              <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
              <For each={collection.items}>
                {item => (
                  <Combobox.Item item={item}>
                    <Combobox.ItemText>{item.label}</Combobox.ItemText>
                    <Combobox.ItemIndicator></Combobox.ItemIndicator>
                  </Combobox.Item>
                )}
              </For>
            </Combobox.ItemGroup>
          </Combobox.Content>
        </Combobox.Positioner>
      </Portal>
    </Combobox.Root>
  )
}
<script lang="ts">
  import { Combobox, createListCollection } from '@destyler-ui/svelte'

  const collection = createListCollection({
    items: [
      { label: 'React', value: 'react' },
      { label: 'Solid', value: 'solid' },
      { label: 'Vue', value: 'vue' },
      { label: 'Svelte', value: 'svelte', disabled: true },
    ],
  })
</script>

<Combobox.Root {collection} multiple>
  <Combobox.Label>Framework</Combobox.Label>
  <Combobox.Control>
    <Combobox.Input />
    <Combobox.Trigger>Open</Combobox.Trigger>
    <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
  </Combobox.Control>
  <Combobox.Positioner>
    <Combobox.Content>
      <Combobox.ItemGroup>
        <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
        {#each collection.items as item (item.value)}
          <Combobox.Item {item}>
            <Combobox.ItemText>{item.label}</Combobox.ItemText>
            <Combobox.ItemIndicator></Combobox.ItemIndicator>
          </Combobox.Item>
        {/each}
      </Combobox.ItemGroup>
      <Combobox.List />
    </Combobox.Content>
  </Combobox.Positioner>
</Combobox.Root>

Combine combobox with a form field for validation and labeling.

<script setup lang="ts">
import { createListCollection } from '@destyler-ui/vue'
import {  Combobox } from '@destyler-ui/vue'
import { Field } from '@destyler-ui/vue'

const frameworks = createListCollection({
  items: ['React', 'Solid', 'Vue'],
})
</script>

<template>
  <Field.Root>
    <Combobox.Root :collection="frameworks">
      <Combobox.Label>Label</Combobox.Label>
      <Combobox.Control>
        <Combobox.Input />
        <Combobox.Trigger>Open</Combobox.Trigger>
        <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
      </Combobox.Control>
      <Combobox.Positioner>
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            <Combobox.Item v-for="item in frameworks.items" :key="item" :item="item">
              <Combobox.ItemText>{{ item }}</Combobox.ItemText>
              <Combobox.ItemIndicator></Combobox.ItemIndicator>
            </Combobox.Item>
          </Combobox.ItemGroup>
        </Combobox.Content>
      </Combobox.Positioner>
    </Combobox.Root>
    <Field.HelperText>Additional Info</Field.HelperText>
    <Field.ErrorText>Error Info</Field.ErrorText>
  </Field.Root>
</template>
import { Field } from '@destyler-ui/react'
import { createListCollection } from '@destyler-ui/react'
import { Combobox } from '@destyler-ui/react'

const collection = createListCollection({
  items: ['React', 'Solid', 'Vue'],
})

interface WithFieldProps {
  disabled?: boolean
  readOnly?: boolean
  invalid?: boolean
  required?: boolean
}

export function WithField(props: WithFieldProps) {
  return (
    <Field.Root disabled={props.disabled} readOnly={props.readOnly} invalid={props.invalid} required={props.required}>
      <Combobox.Root collection={collection} disabled={props.disabled} readOnly={props.readOnly}>
        <Combobox.Label>Label</Combobox.Label>
        <Combobox.Control>
          <Combobox.Input />
          <Combobox.Trigger>Open</Combobox.Trigger>
          <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
        </Combobox.Control>
        <Combobox.Positioner>
          <Combobox.Content>
            <Combobox.ItemGroup>
              <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
              {collection.items.map(item => (
                <Combobox.Item key={item} item={item}>
                  <Combobox.ItemText>{item}</Combobox.ItemText>
                  <Combobox.ItemIndicator></Combobox.ItemIndicator>
                </Combobox.Item>
              ))}
            </Combobox.ItemGroup>
            <Combobox.List />
          </Combobox.Content>
        </Combobox.Positioner>
      </Combobox.Root>
      <Field.HelperText>Additional Info</Field.HelperText>
      <Field.ErrorText>Error Info</Field.ErrorText>
    </Field.Root>
  )
}
import { Combobox, createListCollection } from '@destyler-ui/solid/combobox'
import { Field } from '@destyler-ui/solid/field'
import { For } from 'solid-js'

export function WithField(props: Field.RootProps) {
  const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })

  return (
    <Field.Root {...props}>
      <Combobox.Root collection={collection}>
        <Combobox.Label>Label</Combobox.Label>
        <Combobox.Control>
          <Combobox.Input />
          <Combobox.Trigger>Open</Combobox.Trigger>
          <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
        </Combobox.Control>
        <Combobox.Positioner>
          <Combobox.Content>
            <For each={collection.items}>
              {item => (
                <Combobox.Item item={item}>
                  <Combobox.ItemText>{item}</Combobox.ItemText>
                  <Combobox.ItemIndicator></Combobox.ItemIndicator>
                </Combobox.Item>
              )}
            </For>
          </Combobox.Content>
        </Combobox.Positioner>
      </Combobox.Root>
      <Field.HelperText>Additional Info</Field.HelperText>
      <Field.ErrorText>Error Info</Field.ErrorText>
    </Field.Root>
  )
}
<script module lang="ts">
  export interface WithFieldProps {
    disabled?: boolean
    readOnly?: boolean
    invalid?: boolean
    required?: boolean
  }
</script>

<script lang="ts">
  import { Field } from '@destyler-ui/svelte'
  import { Combobox, createListCollection } from '@destyler-ui/svelte'

  const props: WithFieldProps = $props()
  const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
</script>

<Field.Root {...props}>
  <Combobox.Root {collection} disabled={props.disabled} readOnly={props.readOnly}>
    <Combobox.Label>Label</Combobox.Label>
    <Combobox.Control>
      <Combobox.Input />
      <Combobox.Trigger>Open</Combobox.Trigger>
      <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
    </Combobox.Control>
    <Combobox.Positioner>
      <Combobox.Content>
        <Combobox.ItemGroup>
          <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
          {#each collection.items as item (item)}
            <Combobox.Item {item}>
              <Combobox.ItemText>{item}</Combobox.ItemText>
              <Combobox.ItemIndicator></Combobox.ItemIndicator>
            </Combobox.Item>
          {/each}
        </Combobox.ItemGroup>
        <Combobox.List />
      </Combobox.Content>
    </Combobox.Positioner>
  </Combobox.Root>
  <Field.HelperText>Additional Info</Field.HelperText>
  <Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
<script setup lang="ts">
import { Combobox, useCombobox } from '@destyler-ui/vue'
import { createListCollection } from '@destyler-ui/vue'
import { computed, ref } from 'vue'

const initialItems = ['React', 'Solid', 'Vue']

const items = ref(initialItems)

const collection = computed(() => createListCollection({ items: items.value }))

const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
  items.value = initialItems.filter((item) => item.toLowerCase().includes(details.inputValue.toLowerCase()))
}

const combobox = useCombobox({
  collection: collection.value,
  onInputValueChange: handleInputChange,
})
</script>

<template>
  <button @click="combobox.focus()">Focus</button>

  <Combobox.RootProvider :value="combobox">
    <Combobox.Label>Framework</Combobox.Label>
    <Combobox.Control>
      <Combobox.Input />
      <Combobox.Trigger>Open</Combobox.Trigger>
      <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
    </Combobox.Control>
    <Teleport to="body">
      <Combobox.Positioner>
        <Combobox.Content>
          <Combobox.ItemGroup>
            <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
            <Combobox.Item v-for="item in collection.items" :key="item" :item="item">
              <Combobox.ItemText>{{ item }}</Combobox.ItemText>
              <Combobox.ItemIndicator></Combobox.ItemIndicator>
            </Combobox.Item>
          </Combobox.ItemGroup>
        </Combobox.Content>
      </Combobox.Positioner>
    </Teleport>
  </Combobox.RootProvider>
</template>
import { useMemo, useState } from 'react'
import { createListCollection } from '@destyler-ui/react'
import { Combobox, useCombobox } from '@destyler-ui/react'

const initialItems = ['React', 'Solid', 'Vue']

export function RootProvider() {
  const [items, setItems] = useState(initialItems)

  const collection = useMemo(() => createListCollection({ items }), [items])

  const combobox = useCombobox({
    collection,
    onInputValueChange: ({ inputValue }) => {
      setItems(initialItems.filter(item => item.toLowerCase().includes(inputValue.toLowerCase())))
    },
  })

  return (
    <>
      <button type="button" onClick={() => combobox.focus()}>Focus</button>

      <Combobox.RootProvider value={combobox}>
        <Combobox.Label>Framework</Combobox.Label>
        <Combobox.Control>
          <Combobox.Input />
          <Combobox.Trigger>Open</Combobox.Trigger>
          <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
        </Combobox.Control>
        <Combobox.Positioner>
          <Combobox.Content>
            <Combobox.ItemGroup>
              <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
              {collection.items.map(item => (
                <Combobox.Item key={item} item={item}>
                  <Combobox.ItemText>{item}</Combobox.ItemText>
                  <Combobox.ItemIndicator></Combobox.ItemIndicator>
                </Combobox.Item>
              ))}
            </Combobox.ItemGroup>
            <Combobox.List />
          </Combobox.Content>
        </Combobox.Positioner>
      </Combobox.RootProvider>
    </>
  )
}
import { Combobox, createListCollection, useCombobox } from '@destyler-ui/solid/combobox'
import { createMemo, createSignal, For } from 'solid-js'
import { Portal } from 'solid-js/web'

const initialItems = ['React', 'Solid', 'Vue']

export function RootProvider() {
  const [items, setItems] = createSignal(initialItems)

  const collection = createMemo(() => createListCollection({ items: items() }))

  const handleInputChange = (details: Combobox.InputValueChangeDetails) => {
    setItems(
      initialItems.filter(item => item.toLowerCase().includes(details.inputValue.toLowerCase())),
    )
  }

  const combobox = useCombobox({ collection: collection(), onInputValueChange: handleInputChange })

  return (
    <>
      <button onClick={() => combobox().focus()}>Focus</button>

      <Combobox.RootProvider value={combobox}>
        <Combobox.Label>Framework</Combobox.Label>
        <Combobox.Control>
          <Combobox.Input />
          <Combobox.Trigger>Open</Combobox.Trigger>
          <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
        </Combobox.Control>
        <Portal>
          <Combobox.Positioner>
            <Combobox.Content>
              <Combobox.ItemGroup>
                <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
                <For each={collection().items}>
                  {item => (
                    <Combobox.Item item={item}>
                      <Combobox.ItemText>{item}</Combobox.ItemText>
                      <Combobox.ItemIndicator></Combobox.ItemIndicator>
                    </Combobox.Item>
                  )}
                </For>
              </Combobox.ItemGroup>
            </Combobox.Content>
          </Combobox.Positioner>
        </Portal>
      </Combobox.RootProvider>
    </>
  )
}
<script lang="ts">
  import { Combobox, createListCollection, useCombobox } from '@destyler-ui/svelte'

  const initialItems = ['React', 'Solid', 'Vue']
  let items = $state(initialItems)
  const collection = $derived(createListCollection({ items }))
  const id = $props.id()
  const combobox = useCombobox(() => ({
    collection,
    id,
    onInputValueChange({ inputValue }) {
      items = initialItems.filter(item => item.toLowerCase().includes(inputValue.toLowerCase()))
    },
  }))
</script>

<button type="button" onclick={() => combobox().focus()}>Focus</button>
<Combobox.RootProvider value={combobox}>
  <Combobox.Label>Framework</Combobox.Label>
  <Combobox.Control>
    <Combobox.Input />
    <Combobox.Trigger>Open</Combobox.Trigger>
    <Combobox.ClearTrigger>Clear</Combobox.ClearTrigger>
  </Combobox.Control>
  <Combobox.Positioner>
    <Combobox.Content>
      <Combobox.ItemGroup>
        <Combobox.ItemGroupLabel>Frameworks</Combobox.ItemGroupLabel>
        {#each collection.items as item (item)}
          <Combobox.Item {item}>
            <Combobox.ItemText>{item}</Combobox.ItemText>
            <Combobox.ItemIndicator></Combobox.ItemIndicator>
          </Combobox.Item>
        {/each}
      </Combobox.ItemGroup>
      <Combobox.List />
    </Combobox.Content>
  </Combobox.Positioner>
</Combobox.RootProvider>

Root

PropDefaultType
collection*ListCollection<T>

The collection of items to display in the combobox

allowCustomValuefalse | true

Whether to allow typing custom values in the input

asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

autoFocusfalse | true

Whether to autofocus the input on mount

closeOnSelectfalse | true

Whether to close the combobox when an item is selected.

compositetruefalse | true

Whether the combobox is a composed with other composite widgets like tabs

defaultOpenfalse | true

The initial open state of the combobox when it is first rendered. Use when you do not need to control its open state.

defaultValuestring[]

The initial value of the combobox when it is first rendered. Use when you do not need to control the state of the combobox.

disabledfalse | true

Whether the combobox is disabled

disableLayerfalse | true

Whether to disable registering this a dismissable layer

formstring

The associate form of the combobox.

highlightedValuestring

The active item's id. Used to set the `aria-activedescendant` attribute

idstring

The unique identifier of the machine.

idsPartial<{ root: string; label: string; control: string; input: string; content: string; trigger: string; clearTrigger: string; item: (id: string, index?: number) => string; positioner: string; itemGroup: (id: string | number) => string; itemGroupLabel: (id: string | number) => string; }>

The ids of the elements in the combobox. Useful for composition.

inputBehavior"none""autohighlight" | "autocomplete" | "none"

Defines the auto-completion behavior of the combobox. - `autohighlight`: The first focused item is highlighted as the user types - `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated

inputValuestring

The current value of the combobox's input

invalidfalse | true

Whether the combobox is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocustruefalse | true

Whether to loop the keyboard navigation through the items

modelValuestring[]

The current selected values of the combobox's input

multiplefalse | true

Whether to allow multiple selection. **Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`. It is recommended to render the selected items in a separate container.

namestring

The `name` attribute of the combobox's input. Useful for form submission

navigate(details: combobox.NavigateDetails) => void

Function to navigate to the selected item

openfalse | true

Whether the combobox is open

openOnChangetruefalse | true | ((details: combobox.InputValueChangeDetails) => boolean)

Whether to show the combobox when the input value changes

openOnClickfalsefalse | true

Whether to open the combobox popup on initial click on the input

openOnKeyPresstruefalse | true

Whether to open the combobox on arrow key press

placeholderstring

The placeholder text of the combobox's input

positioningcalendar.PositioningOptions

The positioning options to dynamically position the menu

readOnlyfalse | true

Whether the combobox is readonly. This puts the combobox in a "non-editable" mode but the user can still interact with it

requiredfalse | true

Whether the combobox is required

scrollToIndexFn(details: combobox.ScrollToIndexDetails) => void

Function to scroll to a specific index

selectionBehavior"replace""clear" | "replace" | "preserve"

The behavior of the combobox input when an item is selected - `replace`: The selected item string is set as the input value - `clear`: The input value is cleared - `preserve`: The input value is preserved

translationscombobox.IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

unmountOnExitfalsefalse | true

Whether to unmount on exit.

EmitEvent
focusOutside[event: FocusOutsideEvent]

Function called when the focus is moved outside the component

highlightChange[details: HighlightChangeDetails<T>]

Function called when an item is highlighted using the pointer or keyboard navigation.

inputValueChange[details: InputValueChangeDetails]

Function called when the input's value changes

interactOutside[event: InteractOutsideEvent]

Function called when an interaction happens outside the component

openChange[details: OpenChangeDetails]

Function called when the popup is opened

pointerDownOutside[event: PointerDownOutsideEvent]

Function called when the pointer is pressed down outside the component

update:modelValue[value: string[]]

The callback fired when the model value changes.

update:open[open: boolean]

Event handler called when the open state of the combobox changes.

valueChange[details: ValueChangeDetails<T>]

Function called when a new item is selected

ClearTrigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Content

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Context

No serializable props or emits are declared for this part.

Control

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Input

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Item

PropDefaultType
item*any

The item to render

asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

persistFocusfalse | true

Whether hovering outside should clear the highlighted state

ItemContext

No serializable props or emits are declared for this part.

ItemGroup

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

idstring

ItemGroupLabel

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

ItemIndicator

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

ItemText

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Label

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

List

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Positioner

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

RootProvider

PropDefaultType
value*MachineApi<PropTypes, T>
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

lazyMountfalsefalse | true

Whether to enable lazy mounting

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Trigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

focusablefalse | true

Whether the trigger is focusable

Root

PropDefaultType
collection*ListCollection<T>

The collection of items

allowCustomValuefalse | true

Whether to allow typing custom values in the input

asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

autoFocusfalse | true

Whether to autofocus the input on mount

closeOnSelectfalse | true

Whether to close the combobox when an item is selected.

compositetruefalse | true

Whether the combobox is a composed with other composite widgets like tabs

defaultOpenfalse | true

The initial open state of the combobox when it is first rendered. Use when you do not need to control its open state.

defaultValuestring[]

The initial value of the combobox when it is first rendered. Use when you do not need to control the state of the combobox.

disabledfalse | true

Whether the combobox is disabled

disableLayerfalse | true

Whether to disable registering this a dismissable layer

formstring

The associate form of the combobox.

highlightedValuenull | string

The active item's id. Used to set the `aria-activedescendant` attribute

idstring

The unique identifier of the machine.

idsPartial<{ root: string; label: string; control: string; input: string; content: string; trigger: string; clearTrigger: string; item: (id: string, index?: number) => string; positioner: string; itemGroup: (id: string | number) => string; itemGroupLabel: (id: string | number) => string; }>

The ids of the elements in the combobox. Useful for composition.

immediatefalse | true

Whether to synchronize the present change immediately or defer it to the next frame

inputBehavior"none""autohighlight" | "autocomplete" | "none"

Defines the auto-completion behavior of the combobox. - `autohighlight`: The first focused item is highlighted as the user types - `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated

inputValuestring

The current value of the combobox's input

invalidfalse | true

Whether the combobox is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocustruefalse | true

Whether to loop the keyboard navigation through the items

multiplefalse | true

Whether to allow multiple selection. **Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`. It is recommended to render the selected items in a separate container.

namestring

The `name` attribute of the combobox's input. Useful for form submission

navigate(details: combobox.NavigateDetails) => void

Function to navigate to the selected item

onExitComplete() => void

Function called when the animation ends in the closed state

onFocusOutside(event: calendar.FocusOutsideEvent) => void

Function called when the focus is moved outside the component

onHighlightChange(details: combobox.HighlightChangeDetails<T>) => void

Function called when an item is highlighted using the pointer or keyboard navigation.

onInputValueChange(details: InputValueChangeDetails) => void

Function called when the input's value changes

onInteractOutside(event: calendar.InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange(details: combobox.OpenChangeDetails) => void

Function called when the popup is opened

onPointerDownOutside(event: calendar.PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the component

onValueChange(details: combobox.ValueChangeDetails<T>) => void

Function called when a new item is selected

openfalse | true

Whether the combobox is open

openOnChangetruefalse | true | ((details: InputValueChangeDetails) => boolean)

Whether to show the combobox when the input value changes

openOnClickfalsefalse | true

Whether to open the combobox popup on initial click on the input

openOnKeyPresstruefalse | true

Whether to open the combobox on arrow key press

placeholderstring

The placeholder text of the combobox's input

positioningcalendar.PositioningOptions

The positioning options to dynamically position the menu

presentfalse | true

Whether the node is present (controlled by the user)

readOnlyfalse | true

Whether the combobox is readonly. This puts the combobox in a "non-editable" mode but the user can still interact with it

requiredfalse | true

Whether the combobox is required

scrollToIndexFn(details: combobox.ScrollToIndexDetails) => void

Function to scroll to a specific index

selectionBehavior"replace""clear" | "replace" | "preserve"

The behavior of the combobox input when an item is selected - `replace`: The selected item string is set as the input value - `clear`: The input value is cleared - `preserve`: The input value is preserved

translationscombobox.IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

unmountOnExitfalsefalse | true

Whether to unmount on exit.

valuestring[]

The keys of the selected items

ClearTrigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Content

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Context

PropDefaultType
children*(context: UseComboboxContext<T>) => ReactNode

Control

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Input

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Item

PropDefaultType
item*any

The item to render

asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

persistFocusfalse | true

Whether hovering outside should clear the highlighted state

ItemContext

PropDefaultType
children*(context: UseComboboxItemContext) => ReactNode

ItemGroup

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

ItemGroupLabel

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

ItemIndicator

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

ItemText

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Label

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

List

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Positioner

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

RootProvider

PropDefaultType
value*UseComboboxReturn<T>
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

immediatefalse | true

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalsefalse | true

Whether to enable lazy mounting

onExitComplete() => void

Function called when the animation ends in the closed state

presentfalse | true

Whether the node is present (controlled by the user)

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Trigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

focusablefalse | true

Whether the trigger is focusable

Root

PropDefaultType
collection*ListCollection<T>

The collection of items

allowCustomValuefalse | true

Whether to allow typing custom values in the input

asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

autoFocusfalse | true

Whether to autofocus the input on mount

closeOnSelectfalse | true

Whether to close the combobox when an item is selected.

compositetruefalse | true

Whether the combobox is a composed with other composite widgets like tabs

defaultOpenfalse | true

The initial open state of the combobox when it is first rendered. Use when you do not need to control its open state.

defaultValuestring[]

The initial value of the combobox when it is first rendered. Use when you do not need to control the state of the combobox.

disabledfalse | true

Whether the combobox is disabled

disableLayerfalse | true

Whether to disable registering this a dismissable layer

formstring

The associate form of the combobox.

highlightedValuenull | string

The active item's id. Used to set the `aria-activedescendant` attribute

idsPartial<{ root: string; label: string; control: string; input: string; content: string; trigger: string; clearTrigger: string; item: (id: string, index?: number) => string; positioner: string; itemGroup: (id: string | number) => string; itemGroupLabel: (id: string | number) => string; }>

The ids of the elements in the combobox. Useful for composition.

immediatefalse | true

Whether to synchronize the present change immediately or defer it to the next frame

inputBehavior"none""autohighlight" | "autocomplete" | "none"

Defines the auto-completion behavior of the combobox. - `autohighlight`: The first focused item is highlighted as the user types - `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated

inputValuestring

The current value of the combobox's input

invalidfalse | true

Whether the combobox is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocustruefalse | true

Whether to loop the keyboard navigation through the items

multiplefalse | true

Whether to allow multiple selection. **Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`. It is recommended to render the selected items in a separate container.

namestring

The `name` attribute of the combobox's input. Useful for form submission

navigate(details: combobox.NavigateDetails) => void

Function to navigate to the selected item

onExitComplete() => void

Function called when the animation ends in the closed state

onFocusOutside(event: combobox.FocusOutsideEvent) => void

Function called when the focus is moved outside the component

onHighlightChange(details: combobox.HighlightChangeDetails<T>) => void

Function called when an item is highlighted using the pointer or keyboard navigation.

onInputValueChange(details: InputValueChangeDetails) => void

Function called when the input's value changes

onInteractOutside(event: combobox.InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange(details: OpenChangeDetails) => void

Function called when the popup is opened

onPointerDownOutside(event: combobox.PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the component

onValueChange(details: combobox.ValueChangeDetails<T>) => void

Function called when a new item is selected

openfalse | true

Whether the combobox is open

openOnChangetruefalse | true | ((details: InputValueChangeDetails) => boolean)

Whether to show the combobox when the input value changes

openOnClickfalsefalse | true

Whether to open the combobox popup on initial click on the input

openOnKeyPresstruefalse | true

Whether to open the combobox on arrow key press

placeholderstring

The placeholder text of the combobox's input

positioningcombobox.PositioningOptions

The positioning options to dynamically position the menu

presentfalse | true

Whether the node is present (controlled by the user)

readOnlyfalse | true

Whether the combobox is readonly. This puts the combobox in a "non-editable" mode but the user can still interact with it

requiredfalse | true

Whether the combobox is required

scrollToIndexFn(details: combobox.ScrollToIndexDetails) => void

Function to scroll to a specific index

selectionBehavior"replace""clear" | "replace" | "preserve"

The behavior of the combobox input when an item is selected - `replace`: The selected item string is set as the input value - `clear`: The input value is cleared - `preserve`: The input value is preserved

translationscombobox.IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

unmountOnExitfalsefalse | true

Whether to unmount on exit.

valuestring[]

The keys of the selected items

ClearTrigger

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Content

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Context

PropDefaultType
children*(context: UseComboboxContext<T>) => Element

Control

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Input

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.InputHTMLAttributes<HTMLInputElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Item

PropDefaultType
item*any

The item to render

asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

persistFocusfalse | true

Whether hovering outside should clear the highlighted state

ItemContext

PropDefaultType
children*(context: UseComboboxItemContext) => Element

ItemGroup

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

ItemGroupLabel

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

ItemIndicator

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

ItemText

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLSpanElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Label

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.LabelHTMLAttributes<HTMLLabelElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

List

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Positioner

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

RootProvider

PropDefaultType
value*UseComboboxReturn<T>
asChild(props: (userProps?: solid_js457.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

immediatefalse | true

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalsefalse | true

Whether to enable lazy mounting

onExitComplete() => void

Function called when the animation ends in the closed state

presentfalse | true

Whether the node is present (controlled by the user)

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Trigger

PropDefaultType
asChild(props: (userProps?: solid_js457.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

focusablefalse | true

Whether the trigger is focusable

Root

PropDefaultType
collection*MaybeFunction<ListCollection<T>>

The collection of items

allowCustomValuefalse | true

Whether to allow typing custom values in the input

asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
autoFocusfalse | true

Whether to autofocus the input on mount

childrenSnippet<[]> | undefined
closeOnSelectfalse | true

Whether to close the combobox when an item is selected.

compositetruefalse | true

Whether the combobox is a composed with other composite widgets like tabs

defaultOpenfalse | true
defaultValuestring[]
disabledfalse | true

Whether the combobox is disabled

disableLayerfalse | true

Whether to disable registering this a dismissable layer

formstring

The associate form of the combobox.

highlightedValuenull | string

The active item's id. Used to set the `aria-activedescendant` attribute

idstring
idsPartial<{ root: string; label: string; control: string; input: string; content: string; trigger: string; clearTrigger: string; item: (id: string, index?: number) => string; positioner: string; itemGroup: (id: string | number) => string; itemGroupLabel: (id: string | number) => string; }>

The ids of the elements in the combobox. Useful for composition.

immediatefalse | true

Whether to synchronize the present change immediately or defer it to the next frame

inputBehavior"none""autocomplete" | "autohighlight" | "none"

Defines the auto-completion behavior of the combobox. - `autohighlight`: The first focused item is highlighted as the user types - `autocomplete`: Navigating the listbox with the arrow keys selects the item and the input is updated

inputValuestring

The current value of the combobox's input

invalidfalse | true

Whether the combobox is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocustruefalse | true

Whether to loop the keyboard navigation through the items

multiplefalse | true

Whether to allow multiple selection. **Good to know:** When `multiple` is `true`, the `selectionBehavior` is automatically set to `clear`. It is recommended to render the selected items in a separate container.

namestring

The `name` attribute of the combobox's input. Useful for form submission

navigate((details: NavigateDetails) => void) | undefined

Function to navigate to the selected item

onExitComplete() => void

Function called when the animation ends in the closed state

onFocusOutside((event: FocusOutsideEvent) => void) | undefined

Function called when the focus is moved outside the component

onHighlightChange(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").ComboboxHighlightChangeDetails<T>) => void

Function called when an item is highlighted using the pointer or keyboard navigation.

onInputValueChange(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").ComboboxInputValueChangeDetails) => void

Function called when the input's value changes

onInteractOutside((event: InteractOutsideEvent) => void) | undefined

Function called when an interaction happens outside the component

onOpenChange(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").ComboboxOpenChangeDetails) => void

Function called when the popup is opened

onPointerDownOutside((event: PointerDownOutsideEvent) => void) | undefined

Function called when the pointer is pressed down outside the component

onValueChange(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").ComboboxValueChangeDetails<T>) => void

Function called when a new item is selected

openfalse | true

Whether the combobox is open

openOnChangetruefalse | true | ((details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").ComboboxInputValueChangeDetails) => boolean)

Whether to show the combobox when the input value changes

openOnClickfalsefalse | true

Whether to open the combobox popup on initial click on the input

openOnKeyPresstruefalse | true

Whether to open the combobox on arrow key press

placeholderstring

The placeholder text of the combobox's input

positioningPositioningOptions | undefined

The positioning options to dynamically position the menu

presentfalse | true

Whether the node is present (controlled by the user)

readOnlyfalse | true

Whether the combobox is readonly. This puts the combobox in a "non-editable" mode but the user can still interact with it

requiredfalse | true

Whether the combobox is required

scrollToIndexFn((details: ScrollToIndexDetails) => void) | undefined

Function to scroll to a specific index

selectionBehavior"replace""clear" | "replace" | "preserve"

The behavior of the combobox input when an item is selected - `replace`: The selected item string is set as the input value - `clear`: The input value is cleared - `preserve`: The input value is preserved

skipAnimationOnMountfalsefalse | true

Whether to allow the initial presence animation.

translationsIntlTranslations | undefined

Specifies the localized strings that identifies the accessibility elements and their states

unmountOnExitfalsefalse | true

Whether to unmount on exit.

valuestring[]

The keys of the selected items

ClearTrigger

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]>
childrenSnippet<[]> | undefined

Content

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

Context

PropDefaultType
render*Snippet<[UseComboboxContext<T>]>

Control

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

Input

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"input">]>
childrenSnippet<[]> | undefined

Item

PropDefaultType
item*unknown
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined
persistFocusfalse | true

ItemContext

PropDefaultType
render*Snippet<[UseComboboxItemContext]>

ItemGroup

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined
idstring

ItemGroupLabel

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

ItemIndicator

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

ItemText

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"span">]>
childrenSnippet<[]> | undefined

Label

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"label">]>
childrenSnippet<[]> | undefined

List

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

Positioner

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

RootProvider

PropDefaultType
value*UseComboboxReturn<T>
asChildSnippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined
immediatefalse | true

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalsefalse | true

Whether to enable lazy mounting

onExitComplete() => void

Function called when the animation ends in the closed state

presentfalse | true

Whether the node is present (controlled by the user)

skipAnimationOnMountfalsefalse | true

Whether to allow the initial presence animation.

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Trigger

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]>
childrenSnippet<[]> | undefined