multiple-select-vanilla
v4.4.1
Published
This lib allows you to select multiple elements with checkboxes
Maintainers
Readme
Multiple-Select-Vanilla
Live Demo
Available Live demo to see all available options/methods (there's a lot).
Installation
npm install multiple-select-vanillaBasic Usage
1. from a native <select>
<select class="multiple-select full-width" data-test="select1">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option>
<option value="4">Fourth</option>
</select>and then initialize ms-select
import { multipleSelect } from 'multiple-select-vanilla';
const ms = multipleSelect('.multiple-select');2. or from a data array of string/numbers or text/value pair (object array)
import { multipleSelect } from 'multiple-select-vanilla';
const ms = multipleSelect('.multiple-select', {
data: ['First', 'Second'] // native string/number/boolean
};
const ms = multipleSelect('.multiple-select', {
data: [
// text/value pair
{ text: 'First', value: 1 },
{ text: 'Second', value: 2 },
{ text: 'Third', value: 3 },
{ text: 'Fourth', value: 4 },
]
});