Keyboard shortcut: Ctrl + K
Get started

Combobox

VCombobox searches a list and selects one or more values. Options can be grouped, separated or loaded asynchronously.

Usage

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const country = ref('')

const options = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'fr', label: 'France' },
  { value: 'ch', label: 'Switzerland' },
]
</script>

<template>
  <VCombobox
    v-model="country"
    :options="options"
    aria-label="Country"
    placeholder="Choose a country"
  />
</template>

Examples

Label and hint

Use label to name the field and hint for help text.

vue

Type to narrow the list down. Accents are ignored, so reunion finds Réunion.

<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const country = ref('fr')

const countries = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'ci', label: "Côte d'Ivoire" },
  { value: 'fr', label: 'France' },
  { value: 'lu', label: 'Luxembourg' },
  { value: 're', label: 'Réunion' },
  { value: 'ch', label: 'Switzerland' },
]
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="country"
      :options="countries"
      label="Country"
      hint="Type to narrow the list down. Accents are ignored, so reunion finds Réunion."
      placeholder="Choose a country"
      clearable
    />
  </div>
</template>

<style scoped>
.column {
  max-inline-size: 26rem;
}
</style>

Sizes

size adjusts the field and option rows.

vue
France
France
France
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const countries = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'fr', label: 'France' },
  { value: 'ch', label: 'Switzerland' },
]

const rows = ref(
  (['sm', 'md', 'lg'] as const).map((size) => ({ key: size, size, label: size, selected: ['fr'] })),
)
</script>

<template>
  <div class="column">
    <VCombobox
      v-for="row in rows"
      :key="row.key"
      v-model="row.selected"
      :options="countries"
      :size="row.size"
      :label="row.label"
      multiple
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

States

Use disabled, readonly and invalid for field states, loading during requests, and clearable to clear the selection.

vue

The cross empties the selection and the search at once

For a rule the browser cannot check by itself

Set by your subscription

<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const chosen = ref('fr')

const countries = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'fr', label: 'France' },
  { value: 'ch', label: 'Switzerland' },
]
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="chosen"
      :options="countries"
      clearable
      label="Clearable"
      hint="The cross empties the selection and the search at once"
    />

    <VCombobox
      :options="countries"
      model-value="fr"
      invalid
      label="Invalid"
      hint="For a rule the browser cannot check by itself"
    />

    <VCombobox :options="countries" model-value="fr" disabled label="Disabled" />

    <VCombobox
      :options="countries"
      model-value="fr"
      readonly
      clearable
      label="Read-only"
      hint="Set by your subscription"
    />

    <VCombobox :options="[]" loading label="Loading" placeholder="Fetching the list" />

    <VCombobox
      :options="[]"
      empty-text="No country matches"
      label="Nothing to show"
      placeholder="Open me"
    />
  </div>
</template>

<style scoped>
.column {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Placement

placement sets the preferred panel position. The browser can adjust it to available space.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const departments = [
  { value: 'ops', label: 'Operations and logistics' },
  { value: 'fin', label: 'Finance and accounting' },
  { value: 'eng', label: 'Engineering and platform' },
  { value: 'hr', label: 'People and culture' },
]

const placements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'] as const

const chosen = ref<Record<string, string>>({
  'bottom-start': 'ops',
  'bottom-end': 'fin',
  'top-start': 'eng',
  'top-end': 'hr',
})
</script>

<template>
  <div class="grid">
    <VCombobox
      v-for="placement in placements"
      :key="placement"
      v-model="chosen[placement]"
      :options="departments"
      :placement="placement"
      :label="placement"
    />
  </div>
</template>

<style scoped>
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Groups and separators

options accepts options, named groups and separators.

vue
Europe
Africa
America
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox, type ComboboxItem } from 'vectis-ui'

const country = ref('fr')

const items: ComboboxItem[] = [
  {
    label: 'Europe',
    options: [
      { value: 'fr', label: 'France' },
      { value: 'be', label: 'Belgium' },
      { value: 'ch', label: 'Switzerland' },
      { value: 'lu', label: 'Luxembourg' },
    ],
  },
  { separator: true },
  {
    label: 'Africa',
    options: [
      { value: 're', label: 'Réunion' },
      { value: 'ci', label: "Côte d'Ivoire" },
      { value: 'ma', label: 'Morocco' },
    ],
  },
  {
    label: 'America',
    options: [
      { value: 'ca', label: 'Canada' },
      { value: 'us', label: 'United States' },
      { value: 'br', label: 'Brazil' },
    ],
  },
  { separator: true },
  { value: 'other', label: 'Other, not listed' },
]
</script>

<template>
  <div class="column">
    <VCombobox v-model="country" :options="items" label="Country" placeholder="Choose a country" />
  </div>
</template>

<style scoped>
.column {
  max-inline-size: 26rem;
}
</style>

Multiple selection

multiple uses an array for the selection and displays removable chips.

vue
FranceBelgium

Click elsewhere: the search field folds away and only the chips remain

fr, be
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const served = ref(['fr', 'be'])

const countries = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'ci', label: "Côte d'Ivoire" },
  { value: 'fr', label: 'France' },
  { value: 'lu', label: 'Luxembourg' },
  { value: 'mc', label: 'Monaco', disabled: true },
  { value: 're', label: 'Réunion' },
  { value: 'ch', label: 'Switzerland' },
]
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="served"
      :options="countries"
      multiple
      clearable
      label="Served countries"
      hint="Click elsewhere: the search field folds away and only the chips remain"
      placeholder="Add a country"
    />
    <output class="value" aria-label="Chosen values">{{ served.join(', ') || 'none' }}</output>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-3);
  max-inline-size: 26rem;
}
.value {
  font-family: var(--vectis-text-family-code);
  font-size: var(--vectis-text-body-sm-size);
  color: var(--vectis-color-text-muted);
}
</style>

Creating values

creatable adds a last row offering to create the typed text when no option or chosen value has that label. Choosing it adds the text to v-model and emits create, where you can add the matching option. With nothing to show, the list stays hidden, so :options="[]" gives a free tags input.

vue
Vue

Type a new tag and press Enter to create it

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox, type ComboboxOption } from 'vectis-ui'

const tags = ref(['vue'])

const suggestions = ref<ComboboxOption[]>([
  { value: 'vue', label: 'Vue' },
  { value: 'nuxt', label: 'Nuxt' },
  { value: 'vite', label: 'Vite' },
])

function addSuggestion(text: string) {
  suggestions.value.push({ value: text, label: text })
}
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="tags"
      :options="suggestions"
      multiple
      creatable
      label="Tags"
      hint="Type a new tag and press Enter to create it"
      placeholder="Add a tag"
      @create="addSuggestion"
    />
    <output class="value" aria-label="Chosen values">{{ tags.join(', ') || 'none' }}</output>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-3);
  max-inline-size: 26rem;
}
.value {
  font-family: var(--vectis-text-family-code);
  font-size: var(--vectis-text-body-sm-size);
  color: var(--vectis-color-text-muted);
}
</style>

Values as text

display="text" joins selected labels on one line. Deselect options in the list, or remove the last value with Backspace when the search is empty.

vue
France, Belgium, Switzerland, Luxembourg

One line of labels, cut short when it runs out of room

<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const served = ref(['fr', 'be', 'ch', 'lu'])

const countries = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'ci', label: "Côte d'Ivoire" },
  { value: 'fr', label: 'France' },
  { value: 'lu', label: 'Luxembourg' },
  { value: 'mc', label: 'Monaco', disabled: true },
  { value: 're', label: 'Réunion' },
  { value: 'ch', label: 'Switzerland' },
]
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="served"
      :options="countries"
      multiple
      display="text"
      clearable
      label="Served countries"
      hint="One line of labels, cut short when it runs out of room"
      placeholder="Add a country"
    />
  </div>
</template>

<style scoped>
.column {
  max-inline-size: 20rem;
}
</style>

Visible selection limit

max limits visible values while the field is unfocused. Focus reveals all values. Customize the hidden count with overflowText or #overflow.

vue
FranceBelgium+3

Two chips, the rest counted until the field is focused

France, Belgium+3 countries
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const chips = ref(['fr', 'be', 'ch', 'lu', 're'])
const text = ref(['fr', 'be', 'ch', 'lu', 're'])

const countries = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'ci', label: "Côte d'Ivoire" },
  { value: 'fr', label: 'France' },
  { value: 'lu', label: 'Luxembourg' },
  { value: 're', label: 'Réunion' },
  { value: 'ch', label: 'Switzerland' },
]
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="chips"
      :options="countries"
      multiple
      :max="2"
      label="Served countries"
      hint="Two chips, the rest counted until the field is focused"
    />
    <VCombobox
      v-model="text"
      :options="countries"
      multiple
      display="text"
      :max="2"
      :overflow-text="(count) => `+${count} countries`"
      label="Served countries, as text"
    />
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: 1rem;
  max-inline-size: 20rem;
}
</style>

Field icon

iconStart adds a leading icon, which becomes a button when @click:icon-start is set.

vue
DesignAccessibility

Sorted A to Z.

<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'
import { search, swap_vert as swapVert } from 'vectis-ui/icons'

const topic = ref('')
const tags = ref(['design', 'a11y'])
const order = ref<'A to Z' | 'Z to A'>('A to Z')

const options = [
  { value: 'design', label: 'Design' },
  { value: 'a11y', label: 'Accessibility' },
  { value: 'perf', label: 'Performance' },
  { value: 'docs', label: 'Documentation' },
]

function switchOrder() {
  order.value = order.value === 'A to Z' ? 'Z to A' : 'A to Z'
}
</script>

<template>
  <div class="fields">
    <VCombobox
      v-model="topic"
      :options="options"
      :icon-start="search"
      label="Decorative icon"
      placeholder="Search a topic"
    />

    <VCombobox
      v-model="tags"
      :options="options"
      multiple
      :icon-start="search"
      label="Beside the chips"
    />

    <VCombobox
      v-model="topic"
      :options="options"
      :icon-start="swapVert"
      icon-start-label="Switch the order"
      label="Clickable icon"
      :hint="`Sorted ${order}.`"
      placeholder="Search a topic"
      @click:icon-start="switchOrder"
    />
  </div>
</template>

<style scoped>
.fields {
  display: flex;
  flex-direction: column;
  gap: var(--vectis-space-5);
  max-inline-size: 26rem;
}
</style>

Option icons

Set an option’s icon to display it beside the label.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox, type ComboboxOption } from 'vectis-ui'
import {
  description,
  folder_zip as folderZip,
  image,
  picture_as_pdf as pictureAsPdf,
  table_chart as tableChart,
  video_file as videoFile,
} from 'vectis-ui/icons'

const type = ref('img')

const types: ComboboxOption[] = [
  { value: 'doc', label: 'Document', icon: description },
  { value: 'img', label: 'Image', icon: image },
  { value: 'vid', label: 'Video', icon: videoFile },
  { value: 'pdf', label: 'PDF', icon: pictureAsPdf },
  { value: 'zip', label: 'Archive', icon: folderZip },
  { value: 'raw', label: 'Anything else' },
  { value: 'xls', label: 'Spreadsheet', icon: tableChart, disabled: true },
]
</script>

<template>
  <div class="column">
    <VCombobox v-model="type" :options="types" label="File type" placeholder="Choose a type" />
  </div>
</template>

<style scoped>
.column {
  max-inline-size: 26rem;
}
</style>

Set :filter="false" for server-filtered options. searchDebounce delays search events.

vue

The list is narrowed by the source, so local filtering is turned off

<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox, type ComboboxOption } from 'vectis-ui'

const CATALOGUE: ComboboxOption[] = Array.from({ length: 120 }, (_, i) => ({
  value: `ref-${i + 1}`,
  label: `Reference ${String(i + 1).padStart(3, '0')}`,
}))

function fetchReferences(query: string): Promise<ComboboxOption[]> {
  const found = CATALOGUE.filter((option) =>
    option.label.toLowerCase().includes(query.toLowerCase()),
  )
  return new Promise((resolve) => setTimeout(() => resolve(found.slice(0, 20)), 400))
}

const reference = ref('')
const options = ref<ComboboxOption[]>([])
const loading = ref(false)

/* Ignore stale responses when a newer query has started. */
let latest = 0

async function onSearch(query: string) {
  const current = ++latest
  loading.value = true
  const found = await fetchReferences(query)
  if (current !== latest) return
  options.value = found
  loading.value = false
}
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="reference"
      :options="options"
      :loading="loading"
      :filter="false"
      label="Reference"
      hint="The list is narrowed by the source, so local filtering is turned off"
      placeholder="Search for a reference"
      empty-text="No reference matches"
      clearable
      @search="onSearch"
    />
  </div>
</template>

<style scoped>
.column {
  max-inline-size: 26rem;
}
</style>

Infinite scroll

hasMore enables load-more when the list end becomes visible. Append the next page to options.

vue

Scroll to the foot of the list: the next page is asked for as the end comes into view

0 loaded of 0
<script setup lang="ts">
import { computed, ref } from 'vue'
import { VCombobox, type ComboboxOption } from 'vectis-ui'

const PAGE_SIZE = 20

const CATALOGUE: ComboboxOption[] = Array.from({ length: 120 }, (_, i) => ({
  value: `ref-${i + 1}`,
  label: `Reference ${String(i + 1).padStart(3, '0')}`,
}))

function fetchPage(query: string, page: number) {
  const found = CATALOGUE.filter((option) =>
    option.label.toLowerCase().includes(query.toLowerCase()),
  )
  return new Promise<{ items: ComboboxOption[]; total: number }>((resolve) =>
    setTimeout(
      () =>
        resolve({
          items: found.slice(page * PAGE_SIZE, (page + 1) * PAGE_SIZE),
          total: found.length,
        }),
      400,
    ),
  )
}

const reference = ref('')
const options = ref<ComboboxOption[]>([])
const loading = ref(false)
const total = ref(0)
const page = ref(0)
const query = ref('')

const hasMore = computed(() => options.value.length < total.value)

async function onSearch(term: string) {
  query.value = term
  page.value = 0
  loading.value = true
  const result = await fetchPage(term, 0)
  options.value = result.items
  total.value = result.total
  loading.value = false
}

/* Append results before allowing the sentinel to request another page. */
async function onLoadMore() {
  loading.value = true
  const result = await fetchPage(query.value, page.value + 1)
  page.value += 1
  options.value = [...options.value, ...result.items]
  loading.value = false
}
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="reference"
      :options="options"
      :loading="loading"
      :has-more="hasMore"
      :filter="false"
      label="Reference"
      hint="Scroll to the foot of the list: the next page is asked for as the end comes into view"
      placeholder="Search for a reference"
      @search="onSearch"
      @load-more="onLoadMore"
    />
    <output class="count" aria-label="Options loaded"
      >{{ options.length }} loaded of {{ total }}</output
    >
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-3);
  max-inline-size: 26rem;
}
.count {
  font-family: var(--vectis-text-family-code);
  font-size: var(--vectis-text-body-sm-size);
  color: var(--vectis-color-text-muted);
}
</style>

Long lists

virtual renders only the options near the visible part of the panel, for lists of thousands. Rows are measured as they render, so a custom #option may vary in height.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const product = ref<string | number>('')

const options = Array.from({ length: 10000 }, (_, i) => ({
  value: i + 1,
  label: `Product ${String(i + 1).padStart(5, '0')}`,
}))
</script>

<template>
  <VCombobox
    v-model="product"
    :options="options"
    virtual
    aria-label="Product"
    placeholder="Choose a product"
  />
</template>

Custom options

Use #option to customize option content.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCombobox } from 'vectis-ui'

const country = ref('fr')

const countries = [
  { value: 'be', label: 'Belgium' },
  { value: 'ca', label: 'Canada' },
  { value: 'fr', label: 'France' },
  { value: 'lu', label: 'Luxembourg' },
  { value: 'ch', label: 'Switzerland' },
]

const capitals: Record<string, string> = {
  be: 'Brussels',
  ca: 'Ottawa',
  fr: 'Paris',
  lu: 'Luxembourg',
  ch: 'Bern',
}
</script>

<template>
  <div class="column">
    <VCombobox v-model="country" :options="countries" label="Country">
      <template #option="{ option, selected }">
        <span class="row">
          <span>{{ option.label }}</span>
          <small class="capital"
            >{{ capitals[option.value] }}{{ selected ? ' · chosen' : '' }}</small
          >
        </span>
      </template>
    </VCombobox>
  </div>
</template>

<style scoped>
.column {
  max-inline-size: 26rem;
}
.row {
  display: grid;
}
.capital {
  color: var(--vectis-color-text-muted);
}
</style>

Custom chips

Use #chip to customize selected chips and connect their remove action.

vue
DocumentImage
<script setup lang="ts">
import { ref } from 'vue'
import { VChip, VCombobox, type ComboboxOption } from 'vectis-ui'
import {
  description,
  image,
  picture_as_pdf as pictureAsPdf,
  video_file as videoFile,
} from 'vectis-ui/icons'

const chosen = ref(['doc', 'img'])

const types: ComboboxOption[] = [
  { value: 'doc', label: 'Document', icon: description },
  { value: 'img', label: 'Image', icon: image },
  { value: 'vid', label: 'Video', icon: videoFile },
  { value: 'pdf', label: 'PDF', icon: pictureAsPdf },
]
</script>

<template>
  <div class="column">
    <VCombobox
      v-model="chosen"
      :options="types"
      multiple
      label="File types"
      placeholder="Add a type"
    >
      <!-- Forward size and remove to preserve chip sizing and dismissal. -->
      <template #chip="{ option, label, remove, size }">
        <VChip
          :icon-start="option?.icon"
          :size="size"
          :dismiss-label="`Remove ${label}`"
          variant="outline"
          tone="accent"
          dismissible
          @dismiss="remove"
        >
          {{ label }}
        </VChip>
      </template>
    </VCombobox>
  </div>
</template>

<style scoped>
.column {
  max-inline-size: 26rem;
}
</style>

API

Props

PropTypeDefault
optionsComboboxItem[]none
Options, named groups or separators. Each option has a value and label.
multiplebooleanfalse
Allows multiple selection. Use an array for v-model.
displayComboboxDisplay'chip' | 'text''chip'
Multiple-selection display: removable chips or comma-separated text. Single selection always uses text.
maxnumbernone
Visible selection count while unfocused. Focus shows all values. Omitted or zero shows all values. Applies only with multiple.
overflowText(count: number) => stringnone
Formats the count of values hidden by max. Receives the hidden count.
labelstringnone
Visible label. Without a visible name, provide aria-label or aria-labelledby.
hintstringnone
Help text linked through aria-describedby.
errorstringnone
Error message shown in place of the hint. Sets aria-invalid, is linked through aria-describedby and is announced when it appears.
requiredbooleanfalse
Adds an asterisk after the label and passes required to the field.
hideLabelbooleanfalse
Hides the label visually while keeping it as the accessible name.
labelPositionFieldLabelPosition'top' | 'start''top'
Places the label above the field or beside it.
sizeComboboxSize'sm' | 'md' | 'lg''md'
Field and option size. The field inherits a size set by VInputGroup.
placeholderstringnone
Placeholder shown when the field is empty.
disabledbooleanfalse
Disables interaction.
readonlybooleanfalse
Prevents typing and selection changes. Keeps focus and copying available; hides clear actions and prevents opening the list.
invalidbooleanfalse
Sets aria-invalid and the error style. Does not block form submission by itself.
iconStartIconSourcenone
Leading icon before selected values. A @click:icon-start listener makes it a button requiring iconStartLabel.
iconStartLabelstringnone
Accessible name of the start icon button.
expandIconIconSourceexpand_more
Decorative chevron. Clicking it closes an open list; focus on the field opens the list.
clearablebooleanfalse
Adds an action to clear both selection and search.
clearLabelstringnone
Accessible name of the clear button. Defaults to the library dictionary.
emptyTextstringnone
Title of the default VEmptyState, also announced to screen readers. Keep it consistent with custom #empty content.
filterComboboxFiltertrue
Built-in accent-insensitive filtering, disabled filtering, or a custom function receiving the option and trimmed query.
creatablebooleanfalse
Offers to create the typed text as a new value when it matches no option or chosen value. The list stays hidden instead of showing an empty state, and the chevron is removed while there are no options.
searchDebouncenumber250
Delay in milliseconds before emitting a typed search. Zero emits immediately.
loadingbooleanfalse
Shows a field spinner and a panel loading state: full panel with no options, or list footer with existing options.
loadingTextstringnone
Loading text announced to screen readers. Keep it consistent with custom #loading content.
hasMorebooleanfalse
Enables requests for another page when the list end becomes visible.
virtualbooleanfalse
Renders only the rows near the visible part of the panel, for lists of thousands. Options then carry their position in the list.
placementComboboxPlacement'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end''bottom-start'
Preferred panel position relative to the field.
v-modelItemValue | ItemValue[]''
Selected string or number, or an array with multiple. Defaults to an empty string.

Events

EventType
search[query: string]
Emits the search term after searchDebounce, or immediately on opening. Consecutive duplicate terms are skipped.
click:icon-start[event: MouseEvent]
Emitted when the start icon button is activated.
clear[]
Emitted after clearing selection and search.
load-more[]
Requests the next page when the list end becomes visible.
create[query: string]
Emitted with the typed text after it is added to the value. Add the matching option, or replace the value with your own identifier.

Slots

SlotType
start{}
Content after iconStart, without replacing it.
value-end{}
Content before the clear action and expand icon.
optionListboxOptionSlotProps
Option content. Receives the option, index, active state and selected state.
chipListboxChipSlotProps
Selected chip. Receives value, label, optional option, remove and chip size. Connect the remove action.
overflowListboxOverflowSlotProps
Hidden selection count. Receives count and chip size.
emptyComboboxEmptySlotProps
Empty-state content. Receives the search query; also set emptyText.
loading{}
Initial loading content. Also set loadingText.

Types

Types used in the API tables. Import exported types from vectis-ui.

export interface BuiltinIcon {
  name: string
  paths: readonly [string] | readonly [string, string]
}
export type ChipSize = 'xs' | 'sm'
export interface ComboboxEmptySlotProps {
  query: string
}
export type ComboboxFilter = boolean | ((option: ComboboxOption, query: string) => boolean)
export type ComboboxItem = ListboxItem
export type ComboboxOption = ListboxOption
export type IconRender =
  | { path: string; viewBox?: string }
  | { component: Component; props?: Record<string, unknown> }
  | { src: string }
  | { text: string; class?: string }
  | { class: string }
export type IconSource = string | BuiltinIcon | IconRender
export type ItemValue = string | number
export interface ListboxChipSlotProps {
  value: ItemValue
  option: ListboxOption | undefined
  label: string
  remove: () => void
  size: ChipSize
}
export interface ListboxGroup {
  label: string
  options: ListboxOption[]
}
export type ListboxItem = ListboxOption | ListboxGroup | ListboxSeparator
export interface ListboxOption {
  value: ItemValue
  label: string
  icon?: IconSource
  disabled?: boolean
}
export interface ListboxOptionSlotProps {
  option: ListboxOption
  index: number
  active: boolean
  selected: boolean
}
export interface ListboxOverflowSlotProps {
  count: number
  size: ChipSize
}
export interface ListboxSeparator {
  separator: true
}

CSS variables

TokenValue
--vectis-control-size-combobox-list-max-block18rem