A simple javascript (non jQuery) library for multiple select component that supports Bootstrap 4 natively.
You can install multiple-select-js
in 3 options:
npm i multiple-select-js
And then, simply import it using es6
syntax.
import MultipleSelect from 'multiple-select-js'
<!-- Bootstrap 4 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Multiple Select JS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/multiple-select-js/dist/css/multiple-select.css">
<script src="https://cdn.jsdelivr.net/npm/multiple-select-js/dist/js/multiple-select.js"></script>
<link href="/dist/css/multiple-select.css" rel="stylesheet">
<script src="/dist/js/multiple-select.js"></script>
For single select.
<div class="form-group">
<label for="select-language">Single Select</label>
<select id="select-language">
<option value="php">PHP</option>
<option value="javascript">Javascript</option>
<option value="python">Python</option>
<option value="java">Java</option>
</select>
</div>
new MultipleSelect('#select-language', {
placeholder: 'Select Language'
})
For Multiple select you can simply add multiple
attribute to the select
tag.
<div class="form-group">
<label for="select-language">Multiple Select</label>
<select id="select-multiple-language" multiple>
<option value="php">PHP</option>
<option value="javascript">Javascript</option>
<option value="python">Python</option>
<option value="java">Java</option>
</select>
</div>
new MultipleSelect('#select-multiple-language', {
placeholder: 'Select Language'
})
Go to this link for the complete documentation.
The Multiple Select Js library is open-source software licensed under the MIT license.