MazSelect - with "multiple" options
MazSelect is a standalone component that replaces the standard html input select with a beautiful design system. There are many options like multiple values, search text field, custom templates options, colors, sizes, disabled, loading, error, warning, valid states, error messages, and icons.
Basic usage
selectedValue:
Multiple
selectedValues:
Search
Use search property to add a search input in the options list
TIP
You can use your own template to replace the empty icon when no results are found
View code
<MazSelect>
<template #no-results>
<div class="p-4 text-center">No result</div>
</template>
</MazSelect>INFO
You can adjust the search results by using search-threshold where 1 is a perfect match and 0 is a match with any character
<MazSelect :search-threshold="0.75" :options="[...]" />Custom search function
You can provide your own search function to customize the search behavior
Opt Group
Group your options like a native optgroup
Disabled
Size
Custom template options
Customize the options list with your own template
Custom options model
By default, the options should be an array of { value: any, label: string }
If you want custom keys of these options, you can use:
option-value-keyto override the key of the value in your optionoption-label-keyto override the key of the label to show in the option listoption-input-value-keyto override the key of the value to show in the input
Example
Types
type ModelValueSimple = string | number | null | undefined | booleanEvents
| Event name | Properties | Description |
|---|---|---|
| close | value Event - the event | On list is closed |
| open | On list is opened | |
| blur | value Event - the event | On input blur |
| focus | value Event - the event | On input focus |
| change | value Event - the event | On input change value |
| input | value Event - the event | On input value |
| update:model-value | value MazInputValue | MazInputValue[] - the new value | On model value update, returns the new value |
| selected-option | value MazSelectOption - the option object | On selected value, returns the option object |
Slots
| Name | Description | Bindings |
|---|---|---|
| left-icon | Add a custom left icon | is-open boolean - Current open state of the popoverclose function - Function to close the popoveropen function - Function to open the popovertoggle function - Function to toggle the popover |
| right-icon | Add and replace a custom right icon | is-open boolean - Current open state of the popoverclose function - Function to close the popoveropen function - Function to open the popovertoggle function - Function to toggle the popover |
| no-results | No results slot - Displayed when no results corresponding with search query | |
| optgroup | Custom optgroup label | label String - the label of the optgroup |
| default | Custom option | option Object - the option objectis-selected Boolean - if the option is selectedis-open Boolean - if the popover is openclose function - function to close the popoveropen function - function to open the popovertoggle function - function to toggle the popover |
Expose
open
Open the select
@descriptionThis is used to open the list options
close
Close the select
@descriptionThis is used to close the list options