Skip to content

AsyncTypeahead

AsyncTypeahead

PAsyncTypeahead fetches options asynchronously once the user types two or more characters. It uses a promise-based search function and returns the chosen object.

Demo

Usage

<PAsyncTypeahead
:promise-fun="fetchCustomers"
:selected-item="selectedCustomer"
@select="selectedCustomer = $event"
>
Customer
</PAsyncTypeahead>
methods: {
fetchCustomers(query) {
return api.searchCustomers(query);
},
}

Props

PropTypeDefaultNotes
selectedItemObjectnullSelected item object.
promiseFunFunctionRequired. Must return a promise resolving to { id, label } objects.
disabledBooleanfalseDisables input and list.

Events

EventPayloadDescription
selectObjectEmits the selected item.

Slots

SlotDescription
defaultInput label text.