Skip to content

Select ​

Dropdown select with single/multiple selection, search, groups, tags, and keyboard navigation.

Pick a fruit...
vue
<script setup>
const value = ref(null)
const options = [
  { label: 'Apple', value: 'apple' },
  { label: 'Banana', value: 'banana' },
]
</script>

<template>
  <VxSelect v-model="value" :options="options" />
</template>

String Options ​

Select...
vue
<template>
  <VxSelect :options="['Red', 'Green', 'Blue']" />
</template>

Clearable ​

Banana
banana
vue
<template>
  <VxSelect v-model="value" :options="options" clearable />
</template>

Searchable ​

Search countries...
vue
<template>
  <VxSelect v-model="value" :options="options" searchable />
</template>

Multiple ​

Select fruits...
vue
<template>
  <VxSelect v-model="value" :options="options" multiple />
</template>

Multiple Searchable ​

Search & select...
vue
<template>
  <VxSelect v-model="value" :options="options" multiple searchable clearable />
</template>

Collapse Tags ​

Default (1 tag + N)
Select...
Show 3 tags
Select...
All tags (wrap)
Select...
vue
<template>
  <VxSelect multiple />
  <VxSelect multiple :max-tags="3" />
  <VxSelect multiple :collapse-tags="false" />
</template>

Grouped Options ​

Pick food...
vue
<script setup>
const options = [
  { label: 'Fruits', options: [
    { label: 'Apple', value: 'apple' },
    { label: 'Banana', value: 'banana' },
  ]},
  { label: 'Vegetables', options: [
    { label: 'Carrot', value: 'carrot' },
  ]},
]
</script>

<template>
  <VxSelect :options="options" />
</template>

Disabled Options ​

Some disabled...
vue
<template>
  <VxSelect :options="[{ label: 'Russia', value: 'ru', disabled: true }]" />
</template>

Sizes ​

Small
Default
Large
vue
<template>
  <VxSelect size="sm" />
  <VxSelect />
  <VxSelect size="lg" />
</template>

Loading ​

Show a spinner while options are being fetched.

Loading options...
vue
<script setup>
const loading = ref(true)
const options = ref([])

onMounted(async () => {
  const res = await fetch('/api/options')
  options.value = await res.json()
  loading.value = false
})
</script>

<template>
  <VxSelect v-model="value" :options="options" :loading="loading" />
</template>

Delays filtering for better performance on large option lists.

Search 100 options (300ms debounce)...
vue
<template>
  <VxSelect :options="largeList" searchable :debounce="300" />
</template>
Search countries...
vue
<script setup>
async function fetchOptions(query, page) {
  const res = await fetch(`/api/search?q=${query}&page=${page}`)
  return res.json()
}
</script>

<template>
  <VxSelect :fetch-options="fetchOptions" searchable />
</template>

Paginated (Infinite Scroll) ​

Loads more options when scrolling to the bottom. Set page-count to limit pages.

Scroll to load comments...
vue
<script setup>
async function fetchComments(query, page) {
  const res = await fetch(
    `https://jsonplaceholder.typicode.com/comments?_limit=10&_page=${page}`
  )
  const data = await res.json()
  return data.map(c => ({ label: c.name, value: c.id }))
}
</script>

<template>
  <VxSelect :fetch-options="fetchComments" :page-count="50" searchable />
  <!-- fetchOptions receives (query, page) — page starts from 1 -->
</template>

Creatable (Tag Input) ​

Type a new value and press Enter to create it.

Type to add...
vue
<template>
  <VxSelect v-model="tags" :options="options" multiple searchable creatable />
</template>

Max Selection ​

Max 3 items
vue
<template>
  <VxSelect v-model="value" :options="options" multiple :max-selection="3" />
</template>

Keep Open After Select ​

Stays open...
vue
<template>
  <VxSelect multiple :close-on-select="false" />
</template>

Custom Option Slot ​

With flags...
vue
<template>
  <VxSelect :options="countries">
    <template #option="{ option, label, selected }">
      <span>{{ option.value.toUpperCase() }}</span>
      <span>{{ label }}</span>
      <CheckIcon v-if="selected" />
    </template>
  </VxSelect>
</template>

Disabled ​

Cherry
vue
<template>
  <VxSelect v-model="value" disabled />
</template>

Props ​

PropTypeDefaultDescription
modelValueanynullSelected value(s) (v-model)
options(SelectOption | SelectGroup | string)[][]Options
placeholderstring'Select...'Placeholder
disabledbooleanfalseDisable
clearablebooleanfalseClear button
searchablebooleanfalseEnable search filter
multiplebooleanfalseMulti-select
collapseTagsbooleantrueCollapse multi tags with +N
maxTagsnumber1Tags before collapse
size'sm' | 'default' | 'lg''default'Size
emptyTextstring'No options'Empty state text
debouncenumber0Debounce search filter (ms)
fetchOptions(query: string, page: number) => Promise<Option[]>—Async search function. page starts from 1
loadingbooleanfalseShow loading spinner
creatablebooleanfalseAllow creating new options
closeOnSelectbooleanautoClose after select (auto: true single, false multi)
reserveKeywordbooleanfalseKeep search text after selecting
defaultFirstOptionbooleanfalseAuto-highlight first option
maxSelectionnumber0Max selections (0=unlimited)
pageCountnumber0Max pages for pagination (0=no pagination)
scrollDistancenumber20Pixels from bottom to trigger load more
destroyOnClosebooleanfalseClear cached remote data on close
labelFieldstring'label'Custom label key
valueFieldstring'value'Custom value key
triggerClassstring''Custom trigger class
triggerStyleRecord<string, string>—Custom trigger style

Events ​

EventTypeDescription
update:modelValue(v: any)Selection changed
change(v: any)Selection changed
search(query: string)Search text changed
create(value: string)New option created
loadMore(page: number)Next page requested

Slots ​

SlotPropsDescription
option{ option, label, value, selected }Custom option rendering
tag{ tag, remove }Custom tag rendering
prefix—Before text in trigger
suffix—After text in trigger
empty—No options content