Skip to content

Multiselect ​

te-multiselect is a dropdown with search, select-all and either single or multiple selection. It closes on an outside click, so the plugin's v-click-outside directive has to be registered.

Inside a te-field it takes the id its label points at, its description and its invalid state from the wrapper.

Multiple ​

vue
<te-multiselect
  v-model="picked"
  placeholder="Pick some"
  :options="[{ value: 1, text: 'One' }, { value: 2, text: 'Two' }, { value: 3, text: 'Three' }]"
/>

Single select ​

vue
<te-multiselect
  v-model="one"
  single-select
  placeholder="Pick one"
  :options="[{ value: 1, text: 'One' }, { value: 2, text: 'Two' }]"
/>

Inside a scrolling container ​

An ancestor with overflow: hidden or its own scrollbar clips the open list. append-to-body renders it in <body> instead, anchored to the field while the page or the container scrolls.

vue
<div class="h-32 overflow-auto">
  <te-multiselect v-model="picked" append-to-body :options="options" />
</div>

Keyboard ​

Enter, Space or ↓ on the field opens the list. The focus lands on the search box when there is one, so you can type first and then walk the results with the arrows.

KeyDoes
↑ ↓Previous / next option.
Home EndFirst / last option.
EnterPick the focused option, or tick it when several can be chosen.
SpaceTicks a checkbox, as it does anywhere else.
EscClose and go back to the field.
TabClose and move on.

Props ​

PropTypeDefaultDescription
modelValuestring | number | arrayundefinedSupports v-model. An array unless singleSelect.
optionsobject[][]Option list.
displayFieldstring'text'Key holding the visible text.
valueFieldstring'value'Key holding the value.
singleSelectbooleanfalseOne selection instead of many.
searchablebooleantrueShows the search box.
showSelectAllbooleantrueShows the select-all checkbox.
clearablebooleantrueShows a clear button once something is selected.
visibleItemsnumber3How many labels to list before switching to a count.
placeholderstring''Placeholder of the closed field.
placeholderSearchstring'Search...'Placeholder of the search box.
minWidthstring | number'250px'Minimum width of the field.
listHeightstring | number'250px'Height of the scrolling list.
disabledbooleanfalseDisables the field.
appendToBodybooleanfalseRenders the list in <body> so it is not clipped by a scrolling or overflow: hidden container.

Events ​

EventPayloadDescription
update:modelValuestring | number | arraySelection changed.

Slots ​

SlotPropsDescription
item{ option, key }Custom rendering for an option.