# Typeahead
# Demo
<typeahead
initial-id="14"
initial-value="John Stockton"
id="typeahead-input"
placeholder="Type a name"
:initial-items="[
{ id: 12, value: 'John Cleese' },
{ id: 13, value: 'John Malkovich' },
{ id: 14, value: 'John Stockton' }
]"
hidden-input-name="typeaheadId"
/>
# Props
initial-items | Type
Description
An array of items that will be used to display autocomplete suggestions ( [{ id: 1, value: 'hey' }] )
|
initial-value | Type
Description
Initial value of the autocomplete suggestion |
initial-id | Type
Description
Initial id of the autocomplete suggestion |
src | Type
Description
URL that will be used to fetch autocomplete suggestions (such as: /user/search?q= ).
A query will be appended to this URL.
There is no need to define initial-items when a remote source is defined.
|
id | Type
Description
The id attribute of the input element
|
placeholder | Type
Description
The placeholder attribute of the input element
|
limit | Type Default
Description
Limit the number of autocomplete suggestions, no limit is applied by default |
name | Type
Description
The name of the input field |
hidden-input-name | Type
Description
The name of a hidden input field that will be populated with autocomplete suggestion's id |
# Events
selected | Parameters Description Emitted when an item gets selected |
error | Parameters Description Emitted when an error occurs while sending a request to the remote source |