Multiselect
multiselect is a
vue
component used to select multiple options at the same time. This component only has basic and general style and the users can style it the way they wants, that's why this component can be used in any vue project. Multiselect comes with a optionalTag
component that can be used in the tag slot.
Install
npm install --save multiselect
Global Use
in your main.js
;; Vue;
The global way includes the
Tag
component.
Local Use
in your .vue
file
<script>; name: 'component-name' components: Multiselect Tag ...</script>
How to use
Props
name | value | comments |
---|---|---|
clearable | boolean | hide or show the "x" red button. Clear all selected items from input. |
item-divider | boolean | hide or show line to divide items in menu |
menuMaxHeight | string | menu max height. Default auto . |
minHeight | string | menu min height. Default 2.5rem . |
multiselect | boolean | If It's true multi selections is available but It's false only simple selection is available |
selectAll | boolean | It works in multi selections and with select-all-items slot. This prop select / unselect all items in menu items |
options | array | options to show in menu items |
prop | string | object's prop. This is required when you use objects and its value It has to be unique (index). |
transitionName | string | The name of the vue-transition . |
transitionMode | string | The name of the vue-transition mode (out-in / in-out ). Default out-in . |
Slots
name | Description |
---|---|
tag | slot for item selected in the input |
close-icon | slot for icon to clear selected items |
icon | slot for icon to activate menu |
menu | slot for menu (menu items) |
Multiselector
Multiselector {{tag.name}} ☝ ☓ ♥ Todos ♥ {{menuItem.name}}
;; { return options: id: 1 name: 'Juan' id: 2 name: 'Noah' id: 3 name: 'Churry' id: 4 name: 'Kaki' id: 5 name: 'Pepito' optionsSelected: ;} name: 'app' components: MultiSelect Tag data;
body #app h4 .flex .items-center .justify-between .justify-end .justify-center .multi-select-container .menu-item .menu-item-selected,.selected-icon .vertical-enter-active, .vertical-leave-active .vertical-enter, .vertical-leave-to .selected-icon
Simple Selector
Selector simple con string {{tag}} ☝ ☓ ♥ {{menuItem}}
;; { return stringOptions: 'Rojo' 'Azul' 'Verde' 'Morado' 'Blanco' 'Negro' 'Amarillo' stringSelection: '' ;} name: 'app' components: MultiSelect Tag data;