|
1 |
| -# multi-select-dropdown-js |
2 |
| -Customizable Multi Select Dropdown built with HTML and JavaScript, featuring search, select-all, and dynamic options without dependencies. |
| 1 | + |
| 2 | +# Multi Select Dropdown JS |
| 3 | + |
| 4 | +Create powerful user interfaces with our **Multi Select Dropdown**! This tool enhances native select elements, allowing for multiple selections, dynamic content generation, integrated search functionality, and customizable UI without any dependencies. No jQuery or other library is required! |
| 5 | + |
| 6 | +The complete guide and reference is available here: [https://codeshack.io/multi-select-dropdown-html-javascript/](https://codeshack.io/multi-select-dropdown-html-javascript/) |
| 7 | + |
| 8 | +## Features |
| 9 | +- **Multiple Selections**: Users can select more than one option. |
| 10 | +- **Search Functionality**: Includes a built-in search to find options quickly. |
| 11 | +- **Dynamic Content**: Options can be dynamically added to the dropdown. |
| 12 | +- **Customizable UI**: Style the dropdown to match your site with minimal CSS. |
| 13 | +- **Lightweight**: Lightweight in size and does not depend on other libraries. |
| 14 | +- **Flexible**: Convert your existing native select elements with minimal configuration. |
| 15 | + |
| 16 | +## Quick Start |
| 17 | +Clone the repository and include the CSS and JavaScript files in your project. |
| 18 | + |
| 19 | +Add the following to the <head> tag: |
| 20 | +```html |
| 21 | +<link rel="stylesheet" href="path/to/multi-select-dropdown.css"> |
| 22 | +``` |
| 23 | +Append the following to the <body> tag: |
| 24 | +```html |
| 25 | +<script src="path/to/multi-select-dropdown.js"></script> |
| 26 | +``` |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +Here's a simple example to add the multi-select dropdown to your project: |
| 31 | + |
| 32 | +```html |
| 33 | +<select id="example-multi-select" data-placeholder="Select options" multiple="multiple" data-multi-select> |
| 34 | + <option value="option1">Option 1</option> |
| 35 | + <option value="option2">Option 2</option> |
| 36 | + <!-- more options --> |
| 37 | +</select> |
| 38 | +``` |
| 39 | +Or: |
| 40 | +```html |
| 41 | +<select id="example-multi-select" data-placeholder="Select options" multiple="multiple"> |
| 42 | + <option value="option1">Option 1</option> |
| 43 | + <option value="option2">Option 2</option> |
| 44 | + <!-- more options --> |
| 45 | +</select> |
| 46 | + |
| 47 | +<script src="path/to/multi-select-dropdown.js"></script> |
| 48 | +<script> |
| 49 | + new MultiSelect(document.getElementById('example-multi-select')); |
| 50 | +</script> |
| 51 | +``` |
| 52 | + |
| 53 | +## Configuration |
| 54 | + |
| 55 | +You can pass a settings object to customize the dropdown: |
| 56 | + |
| 57 | +```javascript |
| 58 | +new MultiSelect(document.getElementById('example-multi-select'), { |
| 59 | + placeholder: 'Select options', |
| 60 | + max: 5, // Maximum number of items that can be selected |
| 61 | + search: true, // Enable the search box |
| 62 | + selectAll: true // Add a select all option |
| 63 | +}); |
| 64 | +``` |
| 65 | + |
| 66 | +## Screenshot |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +## License |
| 71 | + |
| 72 | +Distributed under the MIT License. See `LICENSE` for more information. |
| 73 | + |
| 74 | +## Contact |
| 75 | + |
| 76 | + |
| 77 | +GitHub: [https://github.com/codeshackio/multi-select-dropdown-js](https://github.com/codeshackio/multi-select-dropdown-js) |
| 78 | + |
| 79 | +Feel free to open an issue or submit pull requests. |
0 commit comments