Usage
Selects support the user during input and prevent them from entering erroneous data since they only show legal choices within the dropdown. In addition, our selects are very flexible and meet a wide range of requirements within a form. Depending on the use case, we use the appropriate variant of the multiselect. This way, we can guarantee a consistent user experience for each use case.
Anatomy

- Labels. In a multi-select all selected options are displayed as a light
WuiChip
's astag
variant. - States. The selected option is highlighted in shades of $color-active. The hovered option is a bit lighter, the active hovered option is a bit darker.
- Focus. The multiselect remains focused. Even after the dropdown has closed. This way the user can easily make further selections via the keyboard.
- Icons. When closed we use (
fa fa-chevron-down
) - when open we use (fa fa-chevron-up
)
Variants
Single select

- Labels. For single-selects we use plain text and no labels.
- Required. If a single select is required, there is no "x" to delete the content. After the user made a selection, you cannot delete it - only change it.
- Close dropdown. The dropdown will automatically close on select.
Example:
Single select with search
The input field can be used as a search field for filtered options:
Table select
The tabular representation of options is recommended when it is necessary to display several items of information:
Multi select

Each multi-select have the following properties by default:
- All selected options are displayed as a light
WuiChip
's astag
variant within the input field. - The dropdown remains open until the user clicks outside.
- The clear icon is visible as soon as a selection was made. The
x
is not displayed while the dropdown is open. - By default, one or all labels can be deleted. If the user runs the risk of losing a large part of his/her work, omit the "clear all" option or show a confirmation modal before deleting all.
- Selected options can be deleted using the backspace key.
Example:
Multi select collapsed state

The number of visual displayed selections are limited to avoid line breaks inside of the select field. Developers are encouraged to set an appropriate threshold for this to avoid line breaks.
- In the popover, the options are displayed in the order in which they were selected and are not rearranged afterwards.
- A minimum of two selected options should be displayed.
Example:
Selection for complex items

In this case, the selected options are rendered as a list below the input field. This view is particularly suitable for displaying more complex labels, especially if more than one value is displayed in the label, e.g., name + address + email address.
- In contrast to the "default multi-select", this variant does not allow all selected options to be cleared simultaneously. With this variant, the number of expected selections should not be too large.
- Since the selection results in a list, we use the placeholder "add items XYZ" and not "select items XYZ".
- The HTML of the label is variable and can be customized depending on the use case.
- In the example above we additionally use the possibility to display a table in the dropdown. This table goes beyond the width of the input. This is not a must, but it is usually in the nature of things with very complex options.
Tag input

The user can choose from a list of existing options (optional) and additionally enter anything that is not yet part of the option list.
- Depending on the input, the
wui-chip
may contain spaces. - To prevent a user from accidentally deleting the tag list, the to delete all entries at once only appears when the field is no longer focused.
- With return, tags can be created and with backspace they can be deleted again. In addition, the user can navigate through the option list with the arrow keys and select or deselect elements.
Example:
Description
<wui-form-multiselect>
is a complete selecting solution. Specify options based on an array or array of objects
Single select
The basic single select / dropdown doesn’t require much configuration.
The options
prop must be an Array
.
Optional configuration flags (examples):
:searchable="true"
– enables the search functionality:close-on-select="false"
– the dropdown stays open after selecting an option
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="['option1', 'option2', 'option3']"
/>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
};
},
};
</script>
<!-- wui-form-multiselect-single-select-basic.vue -->
Options (record data)
options
is the dropdown data in array format, where each record (option) data are either just a string or keyed objects. Example format:
options
as an array of Strings
const options = ["option1", "option2", "option3"];
options
as an array of Objects
const options = [
{ age: 32, first_name: "Cyndi" },
{ age: 27, first_name: "Havij" },
{ age: 42, first_name: "Robert" },
];
Single select (object)
When working with objects, you must provide additional props: label
and track-by
.
track-by
is used to identify the option within the options list thus it’s value has to be unique. In this example the key
property is unique across all options, so it can be used as track-by
value.
label
is used to display the option.
Optional configuration flags (examples):
:searchable="true"
– enables the search functionality:allow-empty="false"
– once there is a value it can’t be deselected
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
track-by="key"
label="name"
:searchable="true"
:allow-empty="false"
placeholder="Select an option"
/>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
options: [
{ key: "option1", name: "Option 1" },
{ key: "option2", name: "Option 2" },
{ key: "option3", name: "Option 3" },
],
};
},
};
</script>
<!-- wui-form-multiselect-single-select-object.vue -->
Select with search
To enable the search you can set the prop searchable
to true
.
The internal search engine is based on the label
prop. In other words – when searching, wui-form-multiselect only compares the option labels with the current search query. If you want to search inside other object properties look at the options provider function search example.
custom-label
accepts a function with the option
object as the first param. It should return a string which is then used to display a custom label.
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
:custom-label="nameWithLang"
label="name"
track-by="name"
searchable
placeholder="Select an option"
/>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: { name: "Vue.js", language: "JavaScript" },
options: [
{ name: "Vue.js", language: "JavaScript" },
{ name: "Rails", language: "Ruby" },
{ name: "Sinatra", language: "Ruby" },
{ name: "Laravel", language: "PHP" },
{ name: "Phoenix", language: "Elixir" },
],
};
},
methods: {
nameWithLang({ name, language }) {
return `${name} — [${language}]`;
},
},
};
</script>
<!-- wui-form-multiselect-single-select-search.vue -->
Multiple select
To allow multiple selections pass the :multiple="true"
prop.
Optional configuration flags:
:close-on-select="false"
– the dropdown stays open after selecting an option:clear-on-select="false"
– the search query stays the same after selecting an option
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
:multiple="true"
:close-on-select="false"
:clear-on-select="false"
:preserve-search="true"
placeholder="Pick some"
label="name"
track-by="name"
:preselect-first="true"
/>
<div class="m-t-5">Selected: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
options: ["option1", "option2", "option3"],
value: "",
};
},
};
</script>
<!-- wui-form-multiselect-single-select-basic.vue -->
Table selects
To render the dropdown options as a table, you can set the :table="true"
.
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
table
label="country"
track-by="short_code"
/>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
options: [
{ short_code: "DE", country: "Germany", region: "Europe" },
{ short_code: "CH", country: "Switzerland", region: "Europe" },
{ short_code: "AT", country: "Austria", region: "Europe" },
{ short_code: "FR", country: "France", region: "Europe" },
{ short_code: "PL", country: "Poland", region: "Europe" },
],
};
},
};
</script>
<!-- wui-form-multiselect-single-select-table.vue -->
When an array of Objects is provided, <wui-form-multiselect>
automatically samples the first row to extract field names (the keys in the record data). Field names are automatically "humanized" by converting snake_case and camelCase to individual words and capitalizes each word. Example conversions:
first_name
becomesFirst Name
last-name
becomesLast-name
age
becomesAge
YEAR
remainsYEAR
isActive
becomesIs Active
These titles will be displayed in the dropdown table header, in the order they appear in the first record of data. See the Fields section below for customizing how field headings appear.
Note: Field order is not guaranteed. Fields will typically appear in the order they were defined in the first row, but this may not always be the case depending on the version of browser in use. See section Fields (column definitions) below to see how to guarantee the order of fields, and to override the headings generated.
Fields (column definitions)
The fields
prop is used to customize the dropdown table columns headings, and in which order the columns of data are displayed. The field object keys (i.e. country
or region
as shown below) are used to extract the value from each item (record) row.
Fields can be provided as a simple array or an array of objects. Internally the fields data will be normalized into the array of objects format. Events or slots that include the column field
data will be in the normalized field object format (array of objects for fields
, or an object for an individual field
).
Fields as a simple array
Fields can be a simple array, for defining the order of the columns, and which columns to display:
Example: Using array fields definition
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
:fields="fields"
table
label="country"
track-by="short_code"
/>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
fields: ["country", "region", "short_code"],
options: [
{ short_code: "DE", country: "Germany", region: "Europe" },
{ short_code: "CH", country: "Switzerland", region: "Europe" },
{ short_code: "AT", country: "Austria", region: "Europe" },
{ short_code: "FR", country: "France", region: "Europe" },
{ short_code: "PL", country: "Poland", region: "Europe" },
],
};
},
};
</script>
<!-- wui-form-multiselect-single-select-table-fields-as-array.vue -->
Fields as an array of objects
Fields can be a an array of objects, providing additional control over the fields (such as formatting, etc.). Only columns (keys) that appear in the fields array will be shown:
Example: Using array of objects fields definition
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
:fields="fields"
table
label="country"
track-by="short_code"
/>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
fields: [
{
key: "country",
label: "Country",
},
{
key: "region",
label: "Region",
},
{
key: "short_code",
label: "Country code",
class: "wui-bg-color--danger-20",
},
],
options: [
{ short_code: "DE", country: "Germany", region: "Europe" },
{ short_code: "CH", country: "Switzerland", region: "Europe" },
{ short_code: "AT", country: "Austria", region: "Europe" },
{ short_code: "FR", country: "France", region: "Europe" },
{ short_code: "PL", country: "Poland", region: "Europe" },
],
};
},
};
</script>
<!-- wui-form-multiselect-single-select-table-fields-as-objects.vue -->
Field definition reference
The following field properties are recognized:
Property | Type | Description |
---|---|---|
cellAttr | Object or Function | JavaScript object representing additional attributes to apply to the table body field cell. If custom attributes per cell are required, a callback function can be specified instead. The function will be called as cellAttr(optionValue, key, field) and it must return an Object . |
cellClass | String , Array or Function | Class name (or array of class names) to add to table body cells in the column. If custom classes per cell are required, a callback function can be specified instead. The function will be called as cellClass(optionValue, key, field) and it must return an Array or String . |
class | String or Array | Class name (or array of class names) to add to table header cell and body cell in the column. |
formatter | String or Function | A formatter callback function or name of a method in your component, can be used instead of (or in conjunction with) scoped field slots. The formatter will be called with the syntax formatter(value, key, item) . |
headerAttr | Object or Function | JavaScript object representing additional attributes to apply to the field's header cell. If custom attributes per cell are required, a callback function can be specified instead. The function will be called as headerAttr(optionValue, key, field) and it must return an Object . |
headerClass | String or Array | Class name (or array of class names) to add to this field's table header cell. |
headerStyle | Object | JavaScript object representing CSS styles you would like to apply to the table header field cell. |
key | String | The key for selecting data from the record in the items array. Required when setting the fields via an array of objects. The key is also used for generating the custom data rendering and custom header slot names. |
label | String | Appears in the dropdown columns table header. Defaults to the field's key (in humanized format) if not provided. It's possible to use empty labels by assigning an empty string "" . |
Notes:
- Field properties, if not present, default to
null
(falsey) unless otherwise stated above. class
,headerClass
,cellClass
etc. will not work with classes that are defined in scoped CSS, unless you are using VueLoader's Deep selector.- For information on the syntax supported by
headerStyle
, see Class and Style Bindings in the Vue.js guide. - Any additional properties added to the field definition objects will be left intact - so you can access them via the named scoped slots for custom data, header, and footer rendering.
- For information and usage about scoped slots and formatters, refer to the Custom Data Rendering section below.
Feel free to mix and match simple array and object array together:
const fields = [
{ key: "first_name", label: "First" },
{ key: "last_name", label: "Last" },
"age",
"sex",
];
Custom data rendering
Custom rendering for each data field in a row is possible using either scoped slots or a formatter callback function, or a combination of both.
Scoped option slots
You can use option()
scoped slot to provide a custom option template. Look at the provided example for more details. Scoped option slots use the following naming syntax: 'option(' + field key + ')'
.
You can use the default fall-back scoped slot 'option()'
to format any dropdown option items that do not have an explicit scoped slot provided.
Example: Custom option data rendering with scoped slots
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
label="country"
track-by="short_code"
>
<!-- A custom formatted option item -->
<template #option(DE)="props"><strong>{ props.label }</strong></template>
<!-- Optional default option scoped slot -->
<template #option()="props">{ props.label }</template>
</wui-form-multiselect>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
options: [
{ short_code: "DE", country: "Germany", region: "Europe" },
{ short_code: "CH", country: "Switzerland", region: "Europe" },
{ short_code: "AT", country: "Austria", region: "Europe" },
{ short_code: "FR", country: "France", region: "Europe" },
{ short_code: "PL", country: "Poland", region: "Europe" },
],
};
},
};
</script>
<!-- wui-form-multiselect-single-select-scoped-option-slot.vue -->
The slot's scope variable (props
in the above sample) will have the following properties:
Property | Type | Description |
---|---|---|
fields * | Array | The fields of the current option item (*only available in table mode) |
index | Number | The current option item index |
isSelected | Boolean | Whether or not the current option item is selected |
label | String | The normalized label of the current column |
option | String or Object | The current option |
Note:
index
will not always be the actual row's index number, as it is computed after filtering (search query) has been applied to the original options data. Theindex
value will refer to the displayed row number.
Table custom rendering via scoped slots
In addition to the option()
and option({key})
slots, it is also possible to provide custom rendering for the dropdown tables header and for a particular field.
Scoped field slot
Scoped field slots give you greater control over how the record data appears. You can use scoped slots to provided custom rendering for a particular field. If you want to add an extra field which does not exist in the records, just add it to the fields
array, and then reference the field(s) in the scoped slot(s). Scoped field slots use the following naming syntax: 'cell(' + field key + ')'
.
You can use the default fall-back scoped slot 'cell()'
to format any cells that do not have an explicit scoped slot provided.
Example: Custom field data rendering with scoped slots
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
label="country"
track-by="short_code"
>
<!-- A virtual column -->
<template #cell(index)="data"> { data.index + 1 } </template>
<!-- A custom formatted column -->
<template #cell(country)="props">
<b class="wui-color--active">{ props.value.toUpperCase() }</b>
</template>
<!-- A virtual composite column -->
<template #cell(country_region)="props">
{ props.option.country } is in { props.option.region }
</template>
<!-- Optional default data cell scoped slot -->
<template #cell()="props">
<i>{ props.value }</i>
</template>
</wui-form-multiselect>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
fields: [
// A virtual column that doesn't exist in options
"index",
// A regular column
"country",
// A regular column
"region",
// A column that needs custom formatting
{ key: "short_code", label: "Country code" },
// A virtual column made up from two fields
{ key: "country_region", label: "Country and region" },
],
options: [
{ short_code: "DE", country: "Germany", region: "Europe" },
{ short_code: "CH", country: "Switzerland", region: "Europe" },
{ short_code: "AT", country: "Austria", region: "Europe" },
{ short_code: "FR", country: "France", region: "Europe" },
{ short_code: "PL", country: "Poland", region: "Europe" },
],
};
},
};
</script>
<!-- wui-form-multiselect-single-select-scoped-cell-slot.vue -->
The slot's scope variable (props
in the above sample) will have the following properties:
Property | Type | Description |
---|---|---|
field | Object | The field's normalized field definition object |
index | Number | The row number (indexed from zero) relative to the displayed rows (options) |
isSelected | Boolean | Whether or not the current option item is selected |
option | Object | The entire raw record data (i.e. options[index] ) for this row (before any formatter is applied) |
value | Any | The value for this key in the record (null or undefined if a virtual column), or the output of the field's formatter function |
Note:
index
will not always be the actual row's index number, as it is computed after filtering (search query) has been applied to the original options data. Theindex
value will refer to the displayed row number.
Scoped header slot
Scoped slots for the header cells uses a special naming convention of 'head(<fieldkey>)'
.
You can use a default fall-back scoped slot 'head()'
to format any header cells that do not have an explicit scoped slot provided.
Example: Custom header cell rendering with scoped slots
<template>
<div>
<wui-form-multiselect
v-model="value"
:options="options"
label="country"
track-by="short_code"
>
<!-- A custom formatted data column cell -->
<template #cell(country)="props">
<strong>{ props.option.country }</strong>/ { props.option.region }
</template>
<!-- A custom formatted header cell for field 'country' -->
<template #head(country)="props">
<b class="wui-color--active">{ props.label.toUpperCase() }</b>
</template>
<!-- Default fall-back custom formatted header cell -->
<template #head()="props">
<i>{ props.label }</i>
</template>
</wui-form-multiselect>
<div class="m-t-5">Value: { value }</div>
</div>
</template>
<script>
export default {
data() {
return {
value: "",
fields: [
// A regular column
"country",
// A column that needs custom formatting
{ key: "short_code", label: "Country code" },
],
options: [
{ short_code: "DE", country: "Germany", region: "Europe" },
{ short_code: "CH", country: "Switzerland", region: "Europe" },
{ short_code: "AT", country: "Austria", region: "Europe" },
{ short_code: "FR", country: "France", region: "Europe" },
{ short_code: "PL", country: "Poland", region: "Europe" },
],
};
},
};
</script>
<!-- wui-form-multiselect-single-select-scoped-cell-slot.vue -->
The slot's scope variable (props
in the above sample) will have the following properties:
Property | Type | Description |
---|---|---|
column | String | The fields's key value |
field | Object | the field's object (from the fields prop) |
label | String | The fields label value (also available as props.field.label ) |
Infinite scrolling
<wui-form-multiselect>
displays a maximum of 20 options. If more than 20 options are passed through, the component automatically activates infinite scrolling.
Example 1 - providing an array with 50 options
You have an array with 50 options:
const options = {
options: [
{ value: "value_1", text: "Value 1" },
// ... all other 48 options go here
{ value: "value_50", text: "Value 50" },
],
};
Once the dropdown menu opens, only the first 20 options are shown to the user (only 20 items are rendered in HTML). As soon as the user starts scrolling and gets to the end of the list, another 20 options from the already existing options array are rendered and displayed.
Example 2 - using a provider function
Instead of an array, you use a provider function, which returns an array of 1000 options.
const options = {
options: (ctx) => {
// Sample function that makes an API call and returns 1000 items
// return [...1000 items]
},
};
As in example 1, only the first 20 options are displayed here. As soon as the user starts scrolling and gets to the end of the list, another 20 options from the already existing array are revealed.
Note: the provider function is not called again on infinite scrolling as long as the dropdown menu is open unless you set
providerPaging
to true. The provider function is only called when the dropdown menu opens or the user changes the search term.
Using options provider function
As mentioned, it is possible to use a function to provide the select options, by specifying a function reference via the options
prop.
The provider function is called with the following signature:
provider(ctx, [callback]);
The ctx
is the context object associated with the editor's state, and contains the following properties:
Property | Type | Description |
---|---|---|
limit | Number | The maximum number of items to load (default for initial call is 20 , for all subsequent calls 20 ) - optional (only available when providerPaging is set to true ) |
offset | Number | The number of how many items to skip from the record. Useful if you need API pagination with an offset parameter (only available when providerPaging is set to true ) |
query | String | The search term the user has entered in the search input field (searchable must be set to true ) |
The second argument callback
is an optional parameter for when using the callback asynchronous method.
Example: returning an array of filter options (synchronous):
function myProvider() {
let options = [];
// Perform any options processing needed
// Must return an array
return options || [];
}
Example: Using a Promise to return data (asynchronous):
function myProvider(ctx) {
const promise = axios.get(`/some/url?query=${ctx.query}`);
// or with pagination
// const promise = axios.get(
// `/some/url?query=${ctx.query}&offset=${ctx.offset}&limit=${ctx.limit}`
// );
// Must return a promise that resolves to an array of options
return promise.then((data) => {
// Pluck the array of options off our axios response
const options = data.options;
// Must return an array of options or an empty array if an error occurred
return options || [];
});
}
Example: Using an async function (semi-synchronous):
async function myProvider(ctx) {
try {
const response = await axios.get(`/some/url?query=${ctx.query}`);
// or with pagination
// const response = await axios.get(`/some/url?query=${ctx.query}&offset=${ctx.offset}&limit=${ctx.limit});
return response.items;
} catch (error) {
return [];
}
}
Note: The options provider function is called every time the dropdown menu opens.
Options provider paging and filtering
By default, the options provider function is responsible for filtering the data, before passing it to the form-multiselect for display.
You can enable provider paging by setting the providerPaging
prop to true
.
The provider function is triggered as soon as:
- the dropdown menu opens (usually when displayed to the user)
- the user enters a term in the search field (
searchable
must be set totrue
). - the end of the list ist reached by scrolling down and there are no items left to reveal (when
:provider-paging="true"
)
Component reference
<wui-form-multiselect>
<wui-form-multiselect>
Component aliases<wui-form-multiselect>
Properties<wui-form-multiselect>
v-model
<wui-form-multiselect>
Slots<wui-form-multiselect>
Events
Component aliases
<wui-form-multiselect>
can also be used via the following aliases:
<wui-multiselect>
Note: component aliases are only available when importing all of WuiVue or using the component group plugin.
Properties
Property | Type | Default | Description |
---|---|---|---|
allow-empty | Boolean | false | Allows to remove all selected values. Otherwise one must be left selected. Will render an clear 'x' button if set |
aria-invalid | Boolean | false | Sets the 'aria-invalid' attribute with the specified value to the input element |
block-keys | Array | [] | Array of keyboard key aliases to block when selecting |
busy | Boolean | false | Sets the component in busy mode. Will render a loading spinner if set |
clear-on-select | Boolean | true | Clear the search input after select() . Use only when multiple is true . |
close-on-select | Boolean | true | Enable/disable closing after selecting an option |
custom-label | Function | Function used to create a custom label | |
deselect-label | String | '' | String to show when pointing to an already selected option |
disabled | Boolean | false | When set to true , disables the component's functionality and places it in a disabled state |
fields | Array | [] | Array of field names or array of field definition objects (only if table is set) |
fixed | Boolean | false | When set, position: fixed will be applied to the dropdown menu (instead of position: absolute ) |
form | String | ID of the form that the form control belongs to. Sets the form attribute on the control | |
hide-selected | Boolean | false | Hide already selected options in dropdown menu |
hide-tags-when-open | Boolean | false | Hide selected options (tags) when dropdown is open. Only when multiple is set to true |
id | String | Used to set the id attribute on the rendered content, and used as the base to generate any additional element IDs as needed | |
internal-search | String , Object or Array | CSS class (or classes) to apply to the list input group wrapper element (which acts as a form control) | |
input-group-class | Boolean | true | Decide whether to filter the results internally based on search query. Useful for async filtering, where we search through more complex data. |
keep-input-focus | Boolean | false | If set, the search input field will remain focused after the dropdown has closed (either by selecting an option or by pressing the escape key) |
label | String | Label from option Object, that will be visible in the dropdown. | |
limit | Number | 9999 | Limit the display of selected options. The rest will be hidden within the limitText string |
limit-text | Function | (count) => `+ ${count} more` | Function that process the message shown when selected elements pass the defined limit |
max | Number or Boolean | false | Number of allowed selected options. |
menu-class | String , Array or Object | CSS class (or classes) to add to the dropdown menu container | |
menu-size | Object or Boolean | false | Custom size styles of the dropdown menu. Will be forwarded to (https://floating-ui.com/docs/size)[@floating-ui's size ] middleware as the dropdown menu is controlled by this tool |
menu-tag | String | 'ul' | Specify the HTML tag to render the menu instead of the default tag |
multiple | Boolean | false | Equivalent to the multiple attribute on a <select> input. |
name | String | Sets the value of the name attribute on the input form control | |
no-options-text | String | 'List is empty.' | The text to display when showNoOptions is set to true |
no-result-text | String | 'No elements found. Consider changing the search query.' | The text to display when showNoResults is set to true |
options | Array or Function | [] | Array of available options or an options provider function reference: Objects, Strings or Integers. If array of objects, visible label will default to option.label |
placeholder | String | '' | Equivalent to the placeholder attribute on a <select> input. |
preselect-first | Boolean | false | Selects the first option if initial value is empty |
preserve-search | Boolean | false | If set to true, will preserve the search query when opening/closing the component. |
provider-paging | Boolean | false | Whether or not the pagination is controlled by the custom options provider function. If set, the component will call the provider function with offset and limit |
readonly | Boolean | false | Sets the readonly attribute on the input form control |
required | Boolean | false | Adds the required attribute to the input form control |
reset-after | Boolean | false | Reset this.value , this.search , this.selected after this.value changes |
search-placeholder | String | '' | The placeholder text for the search <input> field. Only visible when searchable is set to true . Uses placeholder prop as default |
searchable | Boolean | false | Add / removes search input |
selected-label | String | '' | String to show next to selected option |
show-labels | Boolean | false | Decide whether to show labels on highlighted options |
show-no-options | Boolean | true | Show the noOptions slot if options are empty |
show-no-results | Boolean | true | Show the noResult slot if no results are found |
size | String | Set the size of the component's appearance. 'sm', 'md' (default), or 'lg' | |
state | String or Boolean | null | Controls the validation state appearance of the component. true for valid, false for invalid, warning for warning or null for no validation state |
tabindex | Number | 0 | Adds the tabindex attribute on the input form control |
table | Boolean | false | Renders dropdown options in a table layout instead as a dropdown menu item list |
tag-placeholder | String | '' | String to show when highlighting a potential tag |
tag-position | String | 'top' | By default new tags will appear above the search results. Changing to 'bottom' will revert this behaviour and will proritize the search results |
taggable | Boolean | false | Disable / Enable tagging |
track-by | String | Used to compare objects. Only use if options are objects | |
value v-model | String , Array or Object | The current value of the input |
v-model
Property | Event |
---|---|
value | update |
Slots
Name | Scoped | Description |
---|---|---|
cell() | Yes (see Custom Data Rendering section) | Default scoped slot for custom data rendering of dropdown item field data in table mode. See docs for scoped data |
cell({key}) | Yes (see Custom Data Rendering section) | Scoped slot for custom data rendering of dropdown item field data in table mode. '{key}' is the field's key name. See docs for scoped data |
head() | Yes (see Custom Data Rendering section) | Default scoped slot for custom rendering of field header in table mode. See docs for scoped header |
head({key}) | Yes (see Custom Data Rendering section) | Scoped slot for custom rendering of field header in table mode. '{key}' is the field's key name. See docs for scoped header |
hidden-options-list-item | Yes (see package.json) | Scoped slot for custom hidden options rendering in the view-all dropdown menu |
limit | Yes (see package.json) | Slot to display when the number of selected options is greater than option limit (only when multiple is true ) |
noOptions | Yes (see package.json) | Shows when no elements in options empty |
noResult | Yes (see package.json) | Shows when no elements match the search query |
option() | Yes (see Custom Data Rendering section) | Default scoped slot for custom rendering of dropdown option items in table mode. See docs for scoped option |
option({key}) | Yes (see Custom Data Rendering section) | Scoped slot for custom rendering of dropdown option item in table mode. '{key}' is the option item's name or trackBy property (when options are passed as an array of objects). See docs for scoped option |
placeholder | Yes (see package.json) | Slot for the placeholder (is not displayed when the dropdown is open and searchable is true) |
selectbox-icon | Yes (see package.json) | Slot to render a custom icon instead of chevrons |
selection | Yes (see package.json) | Slot to render custom content for single or multiple selected labels |
singleLabel | Yes (see package.json) | Slot for custom label template for single select (not visible when multiple is true ) |
tag | Yes (see package.json) | Slot that is used for all selected options (tags) when multiple is true |
tags-extended | Yes (see package.json) | Similar to the limit slot except this scoped slot will also overwrite the view-all dropdown. Only visible when length of selected options > limit and :multiple="true" |
Events
Event | Arguments | Description |
---|---|---|
active-item | element - HTMLElement The current dropdown item HTML element | Emitted after a dropdown item gets active state (mouseover or key up/down) in table mode |
clear | Emitted when clear selection button was clicked | |
close | value - The current selected option(s)id - Value of the id prop | Emitted when the dropdown closes |
focus | event - FocusEvent - Native focus event | Emitted after the search input gets focus |
hide | wvEvent - WvEvent object. Call wvEvent.preventDefault() to cancel hide | Emitted just before dropdown is hidden. Cancelable |
open | id - Value of the id prop | Emitted when the dropdown opens. Useful for detecting when touched |
option-mouseenter | value - String , Number , Object or Array - Value of the option item the mouse is hoveringevent - MouseEvent - Native MouseEvent | Emitted when mouse is hovered over a dropdown option item |
option-mouseleave | value - String , Number , Object or Array - Value of the option item the mouse is leavingevent - MouseEvent - Native MouseEvent | Emitted when mouse is leaving a dropdown option item |
refreshed | Emitted when the options provider function has returned data | |
remove | removedOption - String , Number , Object or Array - The removed valueid - Value of the id prop | Emitted after removing an option |
search-change | search - Current value of the search input field | Emitted after the search query changes |
select | selectedOption - String , Number , Object or Array - The selected optionid - Value of the id prop | Emitted after selecting an option |
show | wvEvent - WvEvent object. Call wvEvent.preventDefault() to cancel hide | Emitted just before dropdown is shown. Cancelable |
shown | Emitted when dropdown is show | |
tag | tag - The added tagid - Value of the id prop | Emitted after user attempts to add a tag |
update | value - String , Number , Object or Array - Current selected value(s) of the select | Emitted when the select value changes. Updates the v-model |
update:busy | busy - Boolean - Current busy state (true or false ) | Emitted when the component is in busy state. Either set by the busy prop or automatically set when an options provider function is called |
Importing individual components
You can import individual components into your project via the following named exports:
Component | Named Export |
---|---|
<wui-form-multiselect> | WuiFormMultiselect |
Example
import { WuiFormMultiselect } from "@wui/wui-vue/lib/form-multiselect";
Vue.component("wui-form-multiselect", WuiFormMultiselect);
Importing as a Vue.js plugin
This plugin includes all of the above listed individual components. Plugins also include any component aliases.
Named Export | Import Path |
---|---|
FormMultiselectPlugin | @wui/wui-vue/lib/form-multiselect |
Example
import { FormMultiselectPlugin } from "@wui/wui-vue/lib/form-multiselect";
Vue.use(FormMultiselectPlugin);