Skip to content
UI

Select

A component that allows users to choose from a list of options in a dropdown.

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

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

<template>
  <Select.Root :collection="collection" :openDelay="0" :closeDelay="0">
    <Select.Label>Framework</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
        <Select.Indicator>ChevronDownIcon</Select.Indicator>
      </Select.Trigger>
      <Select.ClearTrigger>Clear</Select.ClearTrigger>
    </Select.Control>
    <Teleport to="body">
      <Select.Positioner data-testid="positioner">
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            <Select.Item v-for="item in collection.items" :key="item.value" :item="item">
              <Select.ItemText>{{ item.label }}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          </Select.ItemGroup>
          <Select.List />
        </Select.Content>
      </Select.Positioner>
    </Teleport>
    <Select.HiddenSelect />
  </Select.Root>
</template>
import { createListCollection } from '@destyler-ui/react'
import { Select } 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?: (value: string[]) => void
  onOpenChange?: (open: boolean) => void
  readOnly?: boolean
  lazyMount?: boolean
  unmountOnExit?: boolean
}

export function Basic(props: BasicProps) {
  return (
    <Select.Root
      collection={collection}
      disabled={props.disabled}
      multiple={props.multiple}
      onValueChange={props.onValueChange}
      onOpenChange={props.onOpenChange}
      readOnly={props.readOnly}
      lazyMount={props.lazyMount}
      unmountOnExit={props.unmountOnExit}
    >
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator>ChevronDownIcon</Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Select.Positioner data-testid="positioner">
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            {collection.items.map(item => (
              <Select.Item key={item.value} item={item}>
                <Select.ItemText>{item.label}</Select.ItemText>
                <Select.ItemIndicator></Select.ItemIndicator>
              </Select.Item>
            ))}
          </Select.ItemGroup>
          <Select.List />
        </Select.Content>
      </Select.Positioner>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
import { createListCollection, Select } from '@destyler-ui/solid/select'
import { Index, Portal } from 'solid-js/web'

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

  return (
    <Select.Root collection={collection}>
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator></Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Portal>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              <Index each={collection.items}>
                {item => (
                  <Select.Item item={item()}>
                    <Select.ItemText>{item()}</Select.ItemText>
                    <Select.ItemIndicator></Select.ItemIndicator>
                  </Select.Item>
                )}
              </Index>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Portal>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
<script module lang="ts">
  import type { SelectRootProps } from '@destyler-ui/svelte'

  type Framework = { label: string, value: string, disabled?: boolean }
  export interface BasicProps extends Omit<SelectRootProps<Framework>, 'collection'> {}
</script>

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

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

<Select.Root {collection} {...props}>
  <Select.Label>Framework</Select.Label>
  <Select.Control>
    <Select.Trigger>
      <Select.ValueText placeholder="Select a Framework" />
      <Select.Indicator>ChevronDownIcon</Select.Indicator>
    </Select.Trigger>
    <Select.ClearTrigger>Clear</Select.ClearTrigger>
  </Select.Control>
  <Select.Positioner data-testid="positioner">
    <Select.Content>
      <Select.ItemGroup>
        <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
        {#each collection.items as item (item.value)}
          <Select.Item {item}>
            <Select.ItemText>{item.label}</Select.ItemText>
            <Select.ItemIndicator></Select.ItemIndicator>
          </Select.Item>
        {/each}
      </Select.ItemGroup>
      <Select.List />
    </Select.Content>
  </Select.Positioner>
  <Select.HiddenSelect />
</Select.Root>
<script setup lang="ts">
import { Select } from '@destyler-ui/vue'
</script>
<template>
<Select.Root>
<Select.Label />
<Select.Control>
<Select.Trigger>
<Select.ValueText />
<Select.Indicator />
</Select.Trigger>
<Select.ClearTrigger />
</Select.Control>
<Select.Positioner>
<Select.Content>
<Select.ItemGroup>
<Select.ItemGroupLabel />
<Select.Item>
<Select.ItemText />
<Select.ItemIndicator />
</Select.Item>
</Select.ItemGroup>
</Select.Content>
</Select.Positioner>
<Select.HiddenSelect />
</Select.Root>
</template>
import { Select } from '@destyler-ui/react'
export default function Basic() {
return (
<Select.Root>
<Select.Label />
<Select.Control>
<Select.Trigger>
<Select.ValueText />
<Select.Indicator />
</Select.Trigger>
<Select.ClearTrigger />
</Select.Control>
<Select.Positioner>
<Select.Content>
<Select.ItemGroup>
<Select.ItemGroupLabel />
<Select.Item>
<Select.ItemText />
<Select.ItemIndicator />
</Select.Item>
</Select.ItemGroup>
</Select.Content>
</Select.Positioner>
<Select.HiddenSelect />
</Select.Root>
)
}
import { createListCollection, Select } from '@destyler-ui/solid'
const collection = createListCollection({ items: ['React', 'Solid', 'Vue'] })
export default function Basic() {
return (
<Select.Root collection={collection}>
<Select.Label />
<Select.Control>
<Select.Trigger>
<Select.ValueText />
<Select.Indicator />
</Select.Trigger>
<Select.ClearTrigger />
</Select.Control>
<Select.Positioner>
<Select.Content>
<Select.ItemGroup>
<Select.ItemGroupLabel />
<Select.Item item={collection.items[0]}>
<Select.ItemText>{collection.items[0]}</Select.ItemText>
<Select.ItemIndicator />
</Select.Item>
</Select.ItemGroup>
</Select.Content>
</Select.Positioner>
<Select.HiddenSelect />
</Select.Root>
)
}
<script lang="ts">
import { Select, createListCollection } from '@destyler-ui/svelte'
const collection = createListCollection({
items: [
{ label: 'React', value: 'react' },
{ label: 'Vue', value: 'vue' },
{ label: 'Svelte', value: 'svelte' },
],
})
</script>
<Select.Root {collection}>
<Select.Label>Framework</Select.Label>
<Select.Control>
<Select.Trigger>
<Select.ValueText placeholder="Select a framework" />
<Select.Indicator></Select.Indicator>
</Select.Trigger>
<Select.ClearTrigger>Clear</Select.ClearTrigger>
</Select.Control>
<Select.Positioner>
<Select.Content>
<Select.ItemGroup>
<Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
{#each collection.items as item (item.value)}
<Select.Item {item}>
<Select.ItemText>{item.label}</Select.ItemText>
<Select.ItemIndicator></Select.ItemIndicator>
</Select.Item>
{/each}
</Select.ItemGroup>
</Select.Content>
</Select.Positioner>
<Select.HiddenSelect />
</Select.Root>
<script setup lang="ts">
import { Select } from '@destyler-ui/vue'
import {createListCollection} from '@destyler-ui/vue'

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

<template>
  <Select.Root :collection="collection" :openDelay="0" :closeDelay="0">
    <Select.Label>Framework</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
        <Select.Indicator>ChevronDownIcon</Select.Indicator>
      </Select.Trigger>
      <Select.ClearTrigger>Clear</Select.ClearTrigger>
    </Select.Control>
    <Teleport to="body">
      <Select.Positioner data-testid="positioner">
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            <Select.Item v-for="item in collection.items" :key="item.value" :item="item">
              <Select.ItemText>{{ item.label }}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          </Select.ItemGroup>
          <Select.List />
        </Select.Content>
      </Select.Positioner>
    </Teleport>
    <Select.HiddenSelect />
  </Select.Root>
</template>
import { createListCollection } from '@destyler-ui/react'
import { Select } 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?: (value: string[]) => void
  onOpenChange?: (open: boolean) => void
  readOnly?: boolean
  lazyMount?: boolean
  unmountOnExit?: boolean
}

export function Basic(props: BasicProps) {
  return (
    <Select.Root
      collection={collection}
      disabled={props.disabled}
      multiple={props.multiple}
      onValueChange={props.onValueChange}
      onOpenChange={props.onOpenChange}
      readOnly={props.readOnly}
      lazyMount={props.lazyMount}
      unmountOnExit={props.unmountOnExit}
    >
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator>ChevronDownIcon</Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Select.Positioner data-testid="positioner">
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            {collection.items.map(item => (
              <Select.Item key={item.value} item={item}>
                <Select.ItemText>{item.label}</Select.ItemText>
                <Select.ItemIndicator></Select.ItemIndicator>
              </Select.Item>
            ))}
          </Select.ItemGroup>
          <Select.List />
        </Select.Content>
      </Select.Positioner>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
import { createListCollection, Select } from '@destyler-ui/solid/select'
import { Index, Portal } from 'solid-js/web'

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

  return (
    <Select.Root collection={collection}>
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator></Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Portal>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              <Index each={collection.items}>
                {item => (
                  <Select.Item item={item()}>
                    <Select.ItemText>{item()}</Select.ItemText>
                    <Select.ItemIndicator></Select.ItemIndicator>
                  </Select.Item>
                )}
              </Index>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Portal>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
<script module lang="ts">
  import type { SelectRootProps } from '@destyler-ui/svelte'

  type Framework = { label: string, value: string, disabled?: boolean }
  export interface BasicProps extends Omit<SelectRootProps<Framework>, 'collection'> {}
</script>

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

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

<Select.Root {collection} {...props}>
  <Select.Label>Framework</Select.Label>
  <Select.Control>
    <Select.Trigger>
      <Select.ValueText placeholder="Select a Framework" />
      <Select.Indicator>ChevronDownIcon</Select.Indicator>
    </Select.Trigger>
    <Select.ClearTrigger>Clear</Select.ClearTrigger>
  </Select.Control>
  <Select.Positioner data-testid="positioner">
    <Select.Content>
      <Select.ItemGroup>
        <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
        {#each collection.items as item (item.value)}
          <Select.Item {item}>
            <Select.ItemText>{item.label}</Select.ItemText>
            <Select.ItemIndicator></Select.ItemIndicator>
          </Select.Item>
        {/each}
      </Select.ItemGroup>
      <Select.List />
    </Select.Content>
  </Select.Positioner>
  <Select.HiddenSelect />
</Select.Root>

Advanced select usage with custom item rendering.

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

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

<template>
  <Select.Root :collection="collection">
    <Select.Label>Framework</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
        <Select.Indicator>
          🔽
        </Select.Indicator>
      </Select.Trigger>
      <Select.ClearTrigger>Clear</Select.ClearTrigger>
    </Select.Control>
    <Teleport to="body">
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            <Select.Item v-for="item in collection.items" :key="item.value" :item="item">
              <Select.ItemText>{{ item.label }}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
    </Teleport>
    <Select.HiddenSelect />
  </Select.Root>
</template>
import { createListCollection } from '@destyler-ui/react'
import { Select } 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 (
    <Select.Root collection={collection}>
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator>🔽</Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            {collection.items.map(item => (
              <Select.Item key={item.value} item={item}>
                <Select.ItemText>{item.label}</Select.ItemText>
                <Select.ItemIndicator></Select.ItemIndicator>
              </Select.Item>
            ))}
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
import { createListCollection, Select } from '@destyler-ui/solid/select'
import { Index, 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 (
    <Select.Root collection={collection}>
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Portal>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              <Index each={collection.items}>
                {item => (
                  <Select.Item item={item()}>
                    <Select.ItemText>{item().label}</Select.ItemText>
                    <Select.ItemIndicator></Select.ItemIndicator>
                  </Select.Item>
                )}
              </Index>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Portal>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
<script lang="ts">
  import { portal } from '@destyler-ui/svelte'
  import { Select, 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>

<Select.Root {collection}>
  <Select.Label>Framework</Select.Label>
  <Select.Control>
    <Select.Trigger>
      <Select.ValueText placeholder="Select a Framework" />
      <Select.Indicator>🔽</Select.Indicator>
    </Select.Trigger>
    <Select.ClearTrigger>Clear</Select.ClearTrigger>
  </Select.Control>
  <div use:portal>
    <Select.Positioner>
      <Select.Content>
        <Select.ItemGroup>
          <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
          {#each collection.items as item (item.value)}
            <Select.Item {item}>
              <Select.ItemText>{item.label}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          {/each}
        </Select.ItemGroup>
      </Select.Content>
    </Select.Positioner>
  </div>
  <Select.HiddenSelect />
</Select.Root>

Control the selected value programmatically.

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

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

<template>
  <Select.Root :collection="collection" v-model="value">
    <Select.Label>Framework</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
        <Select.Indicator>
          🔽
        </Select.Indicator>
      </Select.Trigger>
      <Select.ClearTrigger>Clear</Select.ClearTrigger>
    </Select.Control>
    <Teleport to="body">
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            <Select.Item v-for="item in collection.items" :key="item.value" :item="item">
              <Select.ItemText>{{ item.label }}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
    </Teleport>
    <Select.HiddenSelect />
  </Select.Root>
</template>
import { useState } from 'react'
import { createListCollection } from '@destyler-ui/react'
import { Select } 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 Controlled() {
  const [value, setValue] = useState<string[]>(['vue'])

  return (
    <Select.Root
      collection={collection}
      value={value}
      onValueChange={setValue}
    >
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator>🔽</Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            {collection.items.map(item => (
              <Select.Item key={item.value} item={item}>
                <Select.ItemText>{item.label}</Select.ItemText>
                <Select.ItemIndicator></Select.ItemIndicator>
              </Select.Item>
            ))}
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
import { createListCollection, Select } from '@destyler-ui/solid/select'
import { createSignal } from 'solid-js'
import { Index, Portal } from 'solid-js/web'

interface Item {
  label: string
  value: string
  disabled?: boolean
}

export function Controlled() {
  const [, setSelectedItems] = createSignal<Item[]>([])

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

  return (
    <Select.Root collection={collection} onValueChange={e => setSelectedItems(e.items)}>
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Portal>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              <Index each={collection.items}>
                {item => (
                  <Select.Item item={item()}>
                    <Select.ItemText>{item().label}</Select.ItemText>
                    <Select.ItemIndicator></Select.ItemIndicator>
                  </Select.Item>
                )}
              </Index>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Portal>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
<script lang="ts">
  import { portal } from '@destyler-ui/svelte'
  import { Select, 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 value = $state(['vue'])
</script>

<Select.Root {collection} bind:value>
  <Select.Label>Framework</Select.Label>
  <Select.Control>
    <Select.Trigger>
      <Select.ValueText placeholder="Select a Framework" />
      <Select.Indicator>🔽</Select.Indicator>
    </Select.Trigger>
    <Select.ClearTrigger>Clear</Select.ClearTrigger>
  </Select.Control>
  <div use:portal>
    <Select.Positioner>
      <Select.Content>
        <Select.ItemGroup>
          <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
          {#each collection.items as item (item.value)}
            <Select.Item {item}>
              <Select.ItemText>{item.label}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          {/each}
        </Select.ItemGroup>
      </Select.Content>
    </Select.Positioner>
  </div>
  <Select.HiddenSelect />
</Select.Root>

Enable multiple item selection.

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

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

<template>
  <Select.Root :collection="collection" multiple>
    <Select.Label>Framework</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
        <Select.Indicator>
          🔽
        </Select.Indicator>
      </Select.Trigger>
      <Select.ClearTrigger>Clear</Select.ClearTrigger>
    </Select.Control>
    <Teleport to="body">
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            <Select.Item v-for="item in collection.items" :key="item.value" :item="item">
              <Select.ItemText>{{ item.label }}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
    </Teleport>
    <Select.HiddenSelect />
  </Select.Root>
</template>
import { createListCollection } from '@destyler-ui/react'
import { Select } 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 Multiple() {
  return (
    <Select.Root collection={collection} multiple>
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator>🔽</Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            {collection.items.map(item => (
              <Select.Item key={item.value} item={item}>
                <Select.ItemText>{item.label}</Select.ItemText>
                <Select.ItemIndicator></Select.ItemIndicator>
              </Select.Item>
            ))}
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
import { createListCollection, Select } from '@destyler-ui/solid/select'
import { Index, Portal } from 'solid-js/web'

export function Multiple() {
  const collection = createListCollection({
    items: [
      { label: 'React', value: 'react' },
      { label: 'Solid', value: 'solid' },
      { label: 'Vue', value: 'vue' },
      { label: 'Svelte', value: 'svelte', disabled: true },
    ],
  })
  return (
    <Select.Root collection={collection} multiple>
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Portal>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Index each={collection.items}>
                {item => (
                  <Select.Item item={item()}>
                    <Select.ItemText>{item().label}</Select.ItemText>
                    <Select.ItemIndicator></Select.ItemIndicator>
                  </Select.Item>
                )}
              </Index>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Portal>
      <Select.HiddenSelect />
    </Select.Root>
  )
}
<script lang="ts">
  import { portal } from '@destyler-ui/svelte'
  import { Select, 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>

<Select.Root {collection} multiple>
  <Select.Label>Framework</Select.Label>
  <Select.Control>
    <Select.Trigger>
      <Select.ValueText placeholder="Select a Framework" />
      <Select.Indicator>🔽</Select.Indicator>
    </Select.Trigger>
    <Select.ClearTrigger>Clear</Select.ClearTrigger>
  </Select.Control>
  <div use:portal>
    <Select.Positioner>
      <Select.Content>
        <Select.ItemGroup>
          <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
          {#each collection.items as item (item.value)}
            <Select.Item {item}>
              <Select.ItemText>{item.label}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          {/each}
        </Select.ItemGroup>
      </Select.Content>
    </Select.Positioner>
  </div>
  <Select.HiddenSelect />
</Select.Root>

Use a reactive collection for dynamic options.

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

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

const number = ref(0)

const inc = () => number.value++
const dec = () => number.value--

const collection = computed(() => {
  const newItems = itemsBase.items.map((item) => ({
    ...item,
    label: `${item.label}-${number.value}`,
  }))
  return createListCollection({ items: newItems })
})
</script>

<template>
  <div>
    <button type="button" @click="inc">Inc</button>
    <button type="button" @click="dec">Dec</button>
    <Select.Root :positioning="{ sameWidth: true }" :collection="collection">
      <Select.Label>Framework</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
        </Select.Trigger>
      </Select.Control>
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Framework</Select.ItemGroupLabel>
            <Select.Item v-for="item in collection.items" :item="item" :key="item.label">
              <Select.ItemText>{{ item.label }}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
    </Select.Root>
  </div>
</template>
import { useMemo, useState } from 'react'
import { createListCollection } from '@destyler-ui/react'
import { Select } from '@destyler-ui/react'

const itemsBase = [
  { label: 'React', value: 'react' },
  { label: 'Solid', value: 'solid' },
  { label: 'Svelte', value: 'svelte', disabled: true },
  { label: 'Vue', value: 'vue' },
]

export function ReactiveCollection() {
  const [number, setNumber] = useState(0)

  const inc = () => setNumber(prev => prev + 1)
  const dec = () => setNumber(prev => prev - 1)

  const collection = useMemo(() => {
    const newItems = itemsBase.map(item => ({
      ...item,
      label: `${item.label}-${number}`,
    }))
    return createListCollection({ items: newItems })
  }, [number])

  return (
    <div>
      <button type="button" onClick={inc}>Inc</button>
      <button type="button" onClick={dec}>Dec</button>
      <Select.Root positioning={{ sameWidth: true }} collection={collection}>
        <Select.Label>Framework</Select.Label>
        <Select.Control>
          <Select.Trigger>
            <Select.ValueText placeholder="Select a Framework" />
          </Select.Trigger>
        </Select.Control>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Framework</Select.ItemGroupLabel>
              {collection.items.map(item => (
                <Select.Item key={item.value} item={item}>
                  <Select.ItemText>{item.label}</Select.ItemText>
                  <Select.ItemIndicator></Select.ItemIndicator>
                </Select.Item>
              ))}
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Select.Root>
    </div>
  )
}
import { createListCollection, Select } from '@destyler-ui/solid/select'
import { CheckIcon, ChevronsUpDownIcon } from 'lucide-solid'
import { createMemo, createSignal } from 'solid-js'
import { Index } from 'solid-js/web'

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

export function ReactiveCollection() {
  const [number, setNumber] = createSignal(0)

  const collection = createMemo(() =>
    createListCollection({
      items: items.map(item => ({ ...item, label: `${item.label}-${number()}` })),
    }),
  )

  return (
    <div>
      <button type="button" onClick={() => setNumber(number() + 1)}>
        Inc
      </button>
      <button type="button" onClick={() => setNumber(number() - 1)}>
        Dec
      </button>

      <Select.Root positioning={{ sameWidth: true }} collection={collection()}>
        <Select.Label>Framework</Select.Label>
        <Select.Control>
          <Select.Trigger>
            <Select.ValueText placeholder="Select a Framework" />
            <ChevronsUpDownIcon />
          </Select.Trigger>
        </Select.Control>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Framework</Select.ItemGroupLabel>
              <Index each={collection().items}>
                {item => (
                  <Select.Item item={item()}>
                    <Select.ItemText>{item().label}</Select.ItemText>
                    <Select.ItemIndicator>
                      <CheckIcon />
                    </Select.ItemIndicator>
                  </Select.Item>
                )}
              </Index>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Select.Root>
    </div>
  )
}
<script lang="ts">
  import { Select, createListCollection } from '@destyler-ui/svelte'

  const items = [
    { label: 'React', value: 'react' },
    { label: 'Solid', value: 'solid' },
    { label: 'Svelte', value: 'svelte', disabled: true },
    { label: 'Vue', value: 'vue' },
  ]
  let number = $state(0)
  const collection = $derived(createListCollection({
    items: items.map((item) => ({ ...item, label: `${item.label}-${number}` })),
  }))
</script>

<div>
  <button type="button" onclick={() => number += 1}>Inc</button>
  <button type="button" onclick={() => number -= 1}>Dec</button>
  <Select.Root positioning={{ sameWidth: true }} {collection}>
    <Select.Label>Framework</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
      </Select.Trigger>
    </Select.Control>
    <Select.Positioner>
      <Select.Content>
        <Select.ItemGroup>
          <Select.ItemGroupLabel>Framework</Select.ItemGroupLabel>
          {#each collection.items as item (item.value)}
            <Select.Item {item}>
              <Select.ItemText>{item.label}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          {/each}
        </Select.ItemGroup>
      </Select.Content>
    </Select.Positioner>
  </Select.Root>
</div>

Combine with a form field for validation and labeling.

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

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

<template>
  <Field.Root>
    <Select.Root :collection="collection">
      <Select.Label>Label</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select a Framework" />
          <Select.Indicator>
            🔽
          </Select.Indicator>
        </Select.Trigger>
        <Select.ClearTrigger>Clear</Select.ClearTrigger>
      </Select.Control>
      <Teleport to="body">
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              <Select.Item v-for="item in collection.items" :key="item" :item="item">
                <Select.ItemText>{{ item }}</Select.ItemText>
                <Select.ItemIndicator></Select.ItemIndicator>
              </Select.Item>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
      </Teleport>
      <Select.HiddenSelect />
    </Select.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 { Select } from '@destyler-ui/react'

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

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

export function WithField(props: WithFieldProps) {
  return (
    <Field.Root disabled={props.disabled} readOnly={props.readOnly} invalid={props.invalid}>
      <Select.Root collection={collection} disabled={props.disabled} readOnly={props.readOnly}>
        <Select.Label>Label</Select.Label>
        <Select.Control>
          <Select.Trigger>
            <Select.ValueText placeholder="Select a Framework" />
            <Select.Indicator>🔽</Select.Indicator>
          </Select.Trigger>
          <Select.ClearTrigger>Clear</Select.ClearTrigger>
        </Select.Control>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              {collection.items.map(item => (
                <Select.Item key={item} item={item}>
                  <Select.ItemText>{item}</Select.ItemText>
                  <Select.ItemIndicator></Select.ItemIndicator>
                </Select.Item>
              ))}
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
        <Select.HiddenSelect />
      </Select.Root>
      <Field.HelperText>Additional Info</Field.HelperText>
      <Field.ErrorText>Error Info</Field.ErrorText>
    </Field.Root>
  )
}
import { Field } from '@destyler-ui/solid/field'
import { createListCollection, Select } from '@destyler-ui/solid/select'
import { ChevronDownIcon } from 'lucide-solid'
import { Index } from 'solid-js/web'

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

  return (
    <Field.Root {...props}>
      <Select.Root collection={collection}>
        <Select.Label>Label</Select.Label>
        <Select.Control>
          <Select.Trigger>
            <Select.ValueText placeholder="Select a Framework" />
            <Select.Indicator>
              <ChevronDownIcon />
            </Select.Indicator>
          </Select.Trigger>
        </Select.Control>
        <Select.Positioner>
          ̦
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              <Index each={collection.items}>
                {item => (
                  <Select.Item item={item()}>
                    <Select.ItemText>{item()}</Select.ItemText>
                    <Select.ItemIndicator></Select.ItemIndicator>
                  </Select.Item>
                )}
              </Index>
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
        <Select.HiddenSelect />
      </Select.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
  }
</script>

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

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

<Field.Root {disabled} {readOnly} {invalid}>
  <Select.Root {collection} {disabled} {readOnly}>
    <Select.Label>Label</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
        <Select.Indicator>🔽</Select.Indicator>
      </Select.Trigger>
      <Select.ClearTrigger>Clear</Select.ClearTrigger>
    </Select.Control>
    <div use:portal>
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            {#each collection.items as item (item)}
              <Select.Item {item}>
                <Select.ItemText>{item}</Select.ItemText>
                <Select.ItemIndicator></Select.ItemIndicator>
              </Select.Item>
            {/each}
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
    </div>
    <Select.HiddenSelect />
  </Select.Root>
  <Field.HelperText>Additional Info</Field.HelperText>
  <Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
<script setup lang="ts">
import { Select, useSelect } from '@destyler-ui/vue'
import { createListCollection } from '@destyler-ui/vue'

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

const select = useSelect({ collection: collection })
</script>

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

  <Select.RootProvider :value="select">
    <Select.Label>Framework</Select.Label>
    <Select.Control>
      <Select.Trigger>
        <Select.ValueText placeholder="Select a Framework" />
        <Select.Indicator>
          🔽
        </Select.Indicator>
      </Select.Trigger>
      <Select.ClearTrigger>Clear</Select.ClearTrigger>
    </Select.Control>
    <Teleport to="body">
      <Select.Positioner>
        <Select.Content>
          <Select.ItemGroup>
            <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
            <Select.Item v-for="item in collection.items" :key="item" :item="item">
              <Select.ItemText>{{ item }}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          </Select.ItemGroup>
        </Select.Content>
      </Select.Positioner>
    </Teleport>
    <Select.HiddenSelect />
  </Select.RootProvider>
</template>
import { createListCollection } from '@destyler-ui/react'
import { Select, useSelect } from '@destyler-ui/react'

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

export function RootProvider() {
  const select = useSelect({ collection })

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

      <Select.RootProvider value={select}>
        <Select.Label>Framework</Select.Label>
        <Select.Control>
          <Select.Trigger>
            <Select.ValueText placeholder="Select a Framework" />
            <Select.Indicator>🔽</Select.Indicator>
          </Select.Trigger>
          <Select.ClearTrigger>Clear</Select.ClearTrigger>
        </Select.Control>
        <Select.Positioner>
          <Select.Content>
            <Select.ItemGroup>
              <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
              {collection.items.map(item => (
                <Select.Item key={item} item={item}>
                  <Select.ItemText>{item}</Select.ItemText>
                  <Select.ItemIndicator></Select.ItemIndicator>
                </Select.Item>
              ))}
            </Select.ItemGroup>
          </Select.Content>
        </Select.Positioner>
        <Select.HiddenSelect />
      </Select.RootProvider>
    </>
  )
}
import { createListCollection, Select, useSelect } from '@destyler-ui/solid/select'
import { Index, Portal } from 'solid-js/web'

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

  const select = useSelect({ collection })

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

      <Select.RootProvider value={select}>
        <Select.Label>Framework</Select.Label>
        <Select.Control>
          <Select.Trigger>
            <Select.ValueText placeholder="Select a Framework" />
            <Select.Indicator></Select.Indicator>
          </Select.Trigger>
          <Select.ClearTrigger>Clear</Select.ClearTrigger>
        </Select.Control>
        <Portal>
          <Select.Positioner>
            <Select.Content>
              <Select.ItemGroup>
                <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
                <Index each={collection.items}>
                  {item => (
                    <Select.Item item={item()}>
                      <Select.ItemText>{item()}</Select.ItemText>
                      <Select.ItemIndicator></Select.ItemIndicator>
                    </Select.Item>
                  )}
                </Index>
              </Select.ItemGroup>
            </Select.Content>
          </Select.Positioner>
        </Portal>
        <Select.HiddenSelect />
      </Select.RootProvider>
    </>
  )
}
<script lang="ts">
  import { portal } from '@destyler-ui/svelte'
  import { Select, createListCollection, useSelect } from '@destyler-ui/svelte'

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

<button type="button" onclick={() => select().focus()}>Focus</button>

<Select.RootProvider value={select}>
  <Select.Label>Framework</Select.Label>
  <Select.Control>
    <Select.Trigger>
      <Select.ValueText placeholder="Select a Framework" />
      <Select.Indicator>🔽</Select.Indicator>
    </Select.Trigger>
    <Select.ClearTrigger>Clear</Select.ClearTrigger>
  </Select.Control>
  <div use:portal>
    <Select.Positioner>
      <Select.Content>
        <Select.ItemGroup>
          <Select.ItemGroupLabel>Frameworks</Select.ItemGroupLabel>
          {#each collection.items as item (item)}
            <Select.Item {item}>
              <Select.ItemText>{item}</Select.ItemText>
              <Select.ItemIndicator></Select.ItemIndicator>
            </Select.Item>
          {/each}
        </Select.ItemGroup>
      </Select.Content>
    </Select.Positioner>
  </div>
  <Select.HiddenSelect />
</Select.RootProvider>

Root

PropDefaultType
collection*ListCollection<T>

The collection of items

asChildfalse | true

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

closeOnSelecttruefalse | true

Whether the select should close after an item is selected

compositetruefalse | true

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

defaultOpenfalse | true

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

defaultValuestring[]

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

deselectablefalse | true

Whether the value can be cleared by clicking the selected item. **Note:** this is only applicable for single selection

disabledfalse | true

Whether the select is disabled

formstring

The associate form of the underlying select.

highlightedValuestring

The key of the highlighted item

idstring

The unique identifier of the machine.

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

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

invalidfalse | true

Whether the select is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocusfalsefalse | true

Whether to loop the keyboard navigation through the options

modelValuestring[]
multiplefalse | true

Whether to allow multiple selection

namestring

The `name` attribute of the underlying select.

openfalse | true

Whether the select menu is open

positioningcalendar.PositioningOptions

The positioning options of the menu.

readOnlyfalse | true

Whether the select is read-only

requiredfalse | true

Whether the select is required

scrollToIndexFn(details: select.ScrollToIndexDetails) => void

Function to scroll to a specific index

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>]

The callback fired when the highlighted item 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]

The callback fired when the open state changes.

valueChange[details: ValueChangeDetails<T>]

The callback fired when the selected item changes.

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.

HiddenSelect

PropDefaultType
asChildfalse | true

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

Indicator

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.

ValueText

PropDefaultType
asChildfalse | true

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

placeholderstring

Root

PropDefaultType
collection*ListCollection<T>

The collection of items

asChildfalse | true

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

closeOnSelecttruefalse | true

Whether the select should close after an item is selected

compositetruefalse | true

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

defaultOpenfalse | true

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

defaultValuestring[]

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

deselectablefalse | true

Whether the value can be cleared by clicking the selected item. **Note:** this is only applicable for single selection

disabledfalse | true

Whether the select is disabled

formstring

The associate form of the underlying select.

highlightedValuenull | string

The key of the highlighted item

idstring

The unique identifier of the machine.

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

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

immediatefalse | true

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

invalidfalse | true

Whether the select is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocusfalsefalse | true

Whether to loop the keyboard navigation through the options

multiplefalse | true

Whether to allow multiple selection

namestring

The `name` attribute of the underlying select.

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: select.HighlightChangeDetails<T>) => void

The callback fired when the highlighted item changes.

onInteractOutside(event: calendar.InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange(details: select.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: select.ValueChangeDetails<T>) => void

The callback fired when the selected item changes.

openfalse | true

Whether the select menu is open

positioningcalendar.PositioningOptions

The positioning options of the menu.

presentfalse | true

Whether the node is present (controlled by the user)

readOnlyfalse | true

Whether the select is read-only

requiredfalse | true

Whether the select is required

scrollToIndexFn(details: select.ScrollToIndexDetails) => void

Function to scroll to a specific index

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: UseSelectContext<T>) => ReactNode

Control

PropDefaultType
asChildfalse | true

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

HiddenSelect

PropDefaultType
asChildfalse | true

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

Indicator

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: UseSelectItemContext) => 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.

ItemPropsProvider

No serializable props or emits are declared for this part.

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*UseSelectReturn<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.

ValueText

PropDefaultType
asChildfalse | true

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

placeholderstring

Text to display when no value is selected.

Root

PropDefaultType
collection*ListCollection<T>

The collection of items

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

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

closeOnSelecttruefalse | true

Whether the select should close after an item is selected

compositetruefalse | true

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

defaultOpenfalse | true

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

defaultValuestring[]

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

deselectablefalse | true

Whether the value can be cleared by clicking the selected item. **Note:** this is only applicable for single selection

disabledfalse | true

Whether the select is disabled

formstring

The associate form of the underlying select.

highlightedValuenull | string

The key of the highlighted item

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

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

immediatefalse | true

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

invalidfalse | true

Whether the select is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocusfalsefalse | true

Whether to loop the keyboard navigation through the options

multiplefalse | true

Whether to allow multiple selection

namestring

The `name` attribute of the underlying select.

onExitComplete() => void

Function called when the animation ends in the closed state

onFocusOutside(event: select.FocusOutsideEvent) => void

Function called when the focus is moved outside the component

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

The callback fired when the highlighted item changes.

onInteractOutside(event: select.InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange(details: OpenChangeDetails) => void

Function called when the popup is opened

onPointerDownOutside(event: select.PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the component

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

The callback fired when the selected item changes.

openfalse | true

Whether the select menu is open

positioningselect.PositioningOptions

The positioning options of the menu.

presentfalse | true

Whether the node is present (controlled by the user)

readOnlyfalse | true

Whether the select is read-only

requiredfalse | true

Whether the select is required

scrollToIndexFn(details: select.ScrollToIndexDetails) => void

Function to scroll to a specific index

unmountOnExitfalsefalse | true

Whether to unmount on exit.

valuestring[]

The keys of the selected items

ClearTrigger

PropDefaultType
asChild(props: (userProps?: solid_js164.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_js164.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: UseSelectContext<T>) => Element

Control

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

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

HiddenSelect

PropDefaultType
asChild(props: (userProps?: solid_js164.JSX.SelectHTMLAttributes<HTMLSelectElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

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

Indicator

PropDefaultType
asChild(props: (userProps?: solid_js164.JSX.HTMLAttributes<HTMLDivElement> | 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_js164.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: UseSelectItemContext) => Element

ItemGroup

PropDefaultType
asChild(props: (userProps?: solid_js164.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_js164.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_js164.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

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

ItemPropsProvider

No serializable props or emits are declared for this part.

ItemText

PropDefaultType
asChild(props: (userProps?: solid_js164.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_js164.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_js164.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_js164.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*UseSelectReturn<T>
asChild(props: (userProps?: solid_js164.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_js164.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

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

ValueText

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

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

placeholderstring

Text to display when no value is selected.

Root

PropDefaultType
collection*MaybeFunction<ListCollection<T>>

The collection of items

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

Whether the select should close after an item is selected

compositetruefalse | true

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

defaultOpenfalse | true
defaultValuestring[]
deselectablefalse | true

Whether the value can be cleared by clicking the selected item. **Note:** this is only applicable for single selection

disabledfalse | true

Whether the select is disabled

formstring

The associate form of the underlying select.

highlightedValuenull | string

The key of the highlighted item

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

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

immediatefalse | true

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

invalidfalse | true

Whether the select is invalid

lazyMountfalsefalse | true

Whether to enable lazy mounting

loopFocusfalsefalse | true

Whether to loop the keyboard navigation through the options

multiplefalse | true

Whether to allow multiple selection

namestring

The `name` attribute of the underlying select.

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").SelectHighlightChangeDetails<T>) => void

The callback fired when the highlighted item 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").SelectOpenChangeDetails) => 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").SelectValueChangeDetails<T>) => void

The callback fired when the selected item changes.

openfalse | true

Whether the select menu is open

positioningPositioningOptions | undefined

The positioning options of the menu.

presentfalse | true

Whether the node is present (controlled by the user)

readOnlyfalse | true

Whether the select is read-only

requiredfalse | true

Whether the select is required

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

Function to scroll to a specific index

skipAnimationOnMountfalsefalse | true

Whether to allow the initial presence animation.

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<[UseSelectReturn<T>]>

Control

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

HiddenSelect

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

Indicator

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

Item

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

ItemContext

PropDefaultType
render*Snippet<[UseSelectItemContext]>

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

ItemPropsProvider

No serializable props or emits are declared for this part.

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*UseSelectReturn<T>
asChildimport("svelte").Snippet<[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

ValueText

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