Skip to content
Theme:

Ui3nAutocomplete

Autocomplete component with search, multi-select, chips, and custom filtering capabilities.

Props

NameTypeDefaultDescription
namestring | undefined

HTML name attribute for form submission

chipsboolean | undefined

Whether to show chips

clearOnSelectboolean | undefinedfalse

Whether to clear input on select

customFilter((value: T, query: string) => boolean) | undefined

Custom filter function

disabledboolean | undefined

Whether autocomplete is disabled

filterKeysstring[] | undefined[]

Filter keys

hideSelectedboolean | undefinedfalse

Whether to hide selected items

lockScrollboolean | undefinedfalse

Whether to lock scroll when menu is open

items*T[][]

Items to display

itemTitlekeyof T | undefined"name"

Property to use as title

itemValuekeyof T | undefined"id"

Property to use as value

modelValue*T[] | T[keyof T][]

Current autocomplete value

addNewValueboolean | undefined

Whether to allow adding new values

newValueValidator((value: string) => boolean) | undefined

New value validator function

multipleboolean | undefined

Whether to allow multiple selection

noDataTextstring | undefined

Text to show when no data

placeholderstring | undefined

Placeholder text

returnObjectboolean | undefined

Whether to return the whole object or just the value

Events

Event NameArguments / Value TypeDescription
update:modelValueT[] | T[keyof T][]

Emitted when model value updates

update:searchstring

Emitted when search value updates

update:focusedboolean

Emitted when focused state updates

valid:new-valueboolean

Emitted when new value validation status updates

Slots

Slot NameScope Props (v-slot)Description
#item{ item: T; index: number; query?: string | undefined; }

Item slot

#chip{ item: T | T[keyof T]; index: number; isHighlighted: boolean; }

Chip slot

#noDataText

No data text slot

#selection{ value: T[] | T[keyof T][]; }

Selection slot

Usage Examples

Basic single select

Basic single select

Simple autocomplete with single item selection

Selected: - none -

Multiple selection

Multiple selection

Select multiple items from the list

Selected: []

Chips mode

Chips mode

Display selected items as removable chips

Selected: []

Custom filter

Custom filter

Use custom filter function to search by multiple fields (name and email)

Selected: []

Custom item slot

Custom item slot

Customize dropdown item rendering using the item slot

Selected: []

Return object mode

Return object mode

Return the whole object instead of just the value

Selected objects:
[]

Add new value

Add new value

Allow adding new values with validation. Type a new tag and press Enter

Tags: none
Type a new tag (2-20 chars) and press Enter to add it

Disabled state

Disabled state

Autocomplete in disabled mode

Hide selected and no data text

Hide selected and no data text

Hide already selected items from dropdown and show custom text when no items available

Selected: none
Selected items are hidden from the dropdown

Remote async search

Listen to search updates to fetch items from a remote server dynamically with loading status

Selected User IDs: none
Data is loaded dynamically from mock API on every keystroke with 500ms delay.

Preselected initial values

Preselected initial values

Demonstrates how the component automatically parses and renders pre-populated model values for both primitive IDs and objects

Case A: Flat IDs Mode (default)
ts
node
Current ref value: [ "ts", "node" ]
Case B: Return Object Mode
Vue.js
Current ref value:
[
  {
    "id": "vue",
    "name": "Vue.js",
    "level": "Expert"
  }
]