vueMultiSelect
Probably the most complete selecting solution for Vue.js, without jQuery.
Please note, this field depends on the following library:
Special properties of field
Property
Default
Accepted values
Description
values
none
Array
or Function
List of items. It can be an array with items, or a function, what is resulted an array. The item can be a String
or an object. You can use id
and key
(under selectOptions
) to select any properties of that object as value or name.
max
none
Number
Number of allowed selected options.
selectOptions
{}
Object
Settings to select component. See details below.
selectOptions
selectOptions
For more details, see the official Vue-multiselect documentation.
Property
Default
Accepted values
Description
id
none
Integer
or String
Used to identify the component in events.
multiple
false
Boolean
Equivalent to the multiple
attribute on a input.
trackBy
none
String
Used to compare objects. Only use if options are objects.
label
none
String
Label from option Object, that will be visible in the dropdown.
searchable
true
Boolean
Add / removes search input.
clearOnSelect
true
Boolean
Clear the search input after selection. Use only when multiple is true.
hideSelected
false
Boolean
Hide already selected options
allowEmpty
true
Boolean
Allows to remove all selected values. Otherwise one must be left selected.
resetAfter
false
Boolean
Reset internal this.value
, this.search
, this.selected
after this.value
changes.
closeOnSelect
true
Boolean
Enable/disable closing after selecting an option
customLabel
none
Function => String
Function used to create a custom label
taggable
false
Boolean
Disable / Enable tagging
tagPlaceholder
'Press enter to create a tag'
String
String to show when highlighting a potential tag
optionsLimit
1000
Number
Limits the options displayed in the dropdown to the first X options.
groupValues
none
String
Name of the property containing the group values
groupLabel
none
String
Name of the property containing the group label
blockKeys
[]
Array
Array of keyboard key aliases to block when selecting
internalSearch
true
Boolean
Decide whether to filter the results based on search query. Useful for async filtering, where we search through more complex data.
selectLabel
'Press enter to select'
String
String to show when pointing to an option
selectedLabel
'Selected'
String
String to show next to selected option
deselectLabel
'Press enter to remove'
String
String to show when pointing to an already selected option
showLabels
true
Boolean
Decide whether to show labels on highlighted options
limit
99999
Number
Limit the display of selected options. The rest will be hidden within the limitText string.
limitText
count => `and ${count} more`
Function => String
Function that process the message shown when selected elements pass the defined limit.
loading
false
Boolean
Show/hide the loading spinner.
maxHeight
300
Integer
Sets max-height style value of the dropdown
showPointer
true
Boolean
Enable/disable highlighting of the pointed value.
onSearch
none
Function(searchQuery, id, options)
Emitted after the search query changes
onNewTag
none
Function(newTag, id, options, value)
Emitted after user attempt to add a tag
Usage
Simple select primitive:
Simple select object:
Select with search:
Multiselect with search:
Asynchronous select:
Tagging:
CSS
You have to include the vue-multiselect CSS somewhere. It can be added as a static asset to your application, or inside a component. See here for details.
For example, to include in a component:
Last updated