Skip to content

ComboBox Component

A powerful combobox component that combines the features of a searchable dropdown with the ability to create custom entries. Users can either select from existing options or type their own values.

Overview

The ComboBox component provides:

  • Single and multiple item selection with search
  • Ability to create custom entries by typing
  • Real-time filtering as you type
  • Custom filter functions for advanced filtering
  • Chip display for multiple selections
  • Loading state support
  • Customizable placement and positioning
  • Keyboard navigation support
  • Flexible item text and value mapping

When to Use

Use the ComboBox component when you need to:

  • Create searchable select inputs where users can add custom values
  • Implement tag input fields with predefined suggestions
  • Build multi-select interfaces with custom entry capability
  • Create flexible dropdown lists that accept freeform text
  • Implement autocomplete with the ability to add new options

Key Features

  • Selection Modes:

    • Single selection: Choose one item or create a custom value
    • Multiple selection: Select multiple items or create custom tags
    • Toggle selection: Deselect items by clicking again or removing chips
  • Custom Entry Creation:

    • Type and press Enter to create custom entries
    • Single mode: Typed text becomes the value on blur or menu close
    • Multiple mode: Press Enter to create chips from typed text
    • Custom entries are stored and managed automatically
  • Search & Filtering:

    • Real-time filtering as you type
    • Custom filter function support for advanced filtering
    • Smart scoring system (exact match, starts with, contains)
    • Selected items on top option when searching
  • Display Features:

    • Chip display for multiple selections
    • Dynamic input placeholder based on selection state
    • Checkbox indicators for multiple mode
    • Loading spinner during data fetching
    • Clear button to reset selection
  • Input Features:

    • Searchable input field
    • Clearable selection
    • Readonly and disabled states
    • Loading state with spinner
    • Custom placeholder text
  • Interaction:

    • Click outside to close
    • ESC key to close
    • Enter key to create custom entries
    • Backspace to remove selected items (multiple mode)
    • Keyboard navigation support
    • Smooth animations and transitions
  • Customization:

    • Custom placement (top, bottom, left, right)
    • Offset configuration
    • Custom width settings
    • Flexible styling options
    • Custom item rendering through slots

Props

PropTypeDefaultDescription
itemsArray[]Array of items to display
modelValueString/Number/Array/ObjectnullSelected value(s)
itemTextString'text'Property name for item display text
itemValueString'value'Property name for item value
itemDisabledString'disabled'Property name for item disabled state
multipleBooleanfalseEnable multiple selection
filterFunctionFunctionnullCustom filter function
selectedOnTopBooleanfalseShow selected items at the top
placementString'bottom'Dropdown placement
offsetArray[0, 0.125]Offset from trigger
menuWidthString/NumbernullCustom dropdown width
matchTriggerWidthBooleantrueMatch dropdown width to trigger
placeholderString''Input placeholder text
disabledBooleanfalseDisable the combobox
loadingBooleanfalseShow loading state
clearableBooleanfalseShow clear button
readonlyBooleanfalseMake input readonly

Events

EventPayloadDescription
update:modelValuevalueEmitted when selection changes
changevalueEmitted when selection changes
selectitem, valueEmitted when item is selected
removeitem, valueEmitted when item is removed
searchsearchTextEmitted when search text changes
createitem, valueEmitted when custom item is created

Slots

SlotPropsDescription
no-data-Custom no data content

Methods

MethodDescription
focus()Focus the input field
blur()Blur the input field
openMenu()Open the dropdown menu
closeMenu()Close the dropdown menu
search(value)Set the search text programmatically

Differences from Autocomplete

The ComboBox differs from the Autocomplete component in the following ways:

  • Custom Entry Creation: Users can create new entries by typing and pressing Enter or closing the menu
  • Freeform Input: Accepts any text input, not just predefined options
  • Create Event: Emits a create event when new custom items are added
  • Flexible Values: In single mode, the typed text becomes the value automatically

Demo →

API Reference →

View Code →