UNPKG

@gpaol/bootstrap-multiselect

Version:

Bootstrap 5 MultiSelect component with search, filtering, grouped options, pagination, and comprehensive localization support

179 lines (134 loc) • 5.8 kB
# Bootstrap MultiSelect jQuery Plugin A modern, feature-rich Bootstrap 5 MultiSelect component with search, filtering, grouped options, and comprehensive localization support. ## šŸ“¦ Package Name `@gpaol/bootstrap-multiselect` ## šŸ“‚ Package Structure ```text @gpaol/bootstrap-multiselect/ ā”œā”€ā”€ src/ │ ā”œā”€ā”€ css/ │ │ ā”œā”€ā”€ bootstrap-multiselect.css │ │ └── bootstrap-multiselect.min.css │ ā”œā”€ā”€ js/ │ │ ā”œā”€ā”€ bootstrap-multiselect.js │ │ └── bootstrap-multiselect.min.js │ └── langs/ # Localization files │ ā”œā”€ā”€ bootstrap-multiselect.de.js │ ā”œā”€ā”€ bootstrap-multiselect.de.min.js │ ā”œā”€ā”€ bootstrap-multiselect.es.js │ ā”œā”€ā”€ bootstrap-multiselect.es.min.js │ ā”œā”€ā”€ bootstrap-multiselect.fr.js │ ā”œā”€ā”€ bootstrap-multiselect.fr.min.js │ ā”œā”€ā”€ bootstrap-multiselect.it.js │ ā”œā”€ā”€ bootstrap-multiselect.it.min.js │ ā”œā”€ā”€ bootstrap-multiselect.pt.js │ └── bootstrap-multiselect.pt.min.js ā”œā”€ā”€ package.json ā”œā”€ā”€ LICENSE └── README.md ``` ## šŸš€ Installation ### via npm ```bash npm install @gpaol/bootstrap-multiselect ``` ### via CDN ```html <!-- CSS --> <link href="https://cdn.jsdelivr.net/npm/@gpaol/bootstrap-multiselect@1.2.0/src/css/bootstrap-multiselect.min.css" rel="stylesheet"> <!-- JavaScript --> <script src="https://cdn.jsdelivr.net/npm/@gpaol/bootstrap-multiselect@1.2.0/src/js/bootstrap-multiselect.min.js"></script> ``` ## šŸ“– Usage After installing via npm, you can import the files in your project: ```html <!DOCTYPE html> <html> <head> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="node_modules/@gpaol/bootstrap-multiselect/src/css/bootstrap-multiselect.min.css" rel="stylesheet"> </head> <body> <select id="mySelect" multiple> <option value="1">Option 1</option> <option value="2">Option 2</option> <option value="3">Option 3</option> </select> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <script src="node_modules/@gpaol/bootstrap-multiselect/src/js/bootstrap-multiselect.min.js"></script> <script> $('#mySelect').bootstrapMultiSelect({ placeholder: 'Select items...', enableSearch: true, showSelectAll: true, enablePagination: true, itemsPerPage: 10 }); </script> </body> </html> ``` ### Using with Module Bundlers If you're using a module bundler like Webpack or Vite: ```javascript // Import CSS import '@gpaol/bootstrap-multiselect/src/css/bootstrap-multiselect.min.css'; // Import JavaScript import '@gpaol/bootstrap-multiselect/src/js/bootstrap-multiselect.min.js'; // Use the plugin $('#mySelect').bootstrapMultiSelect({ placeholder: 'Select items...', enableSearch: true, showSelectAll: true }); ``` ## šŸŒ Localization The plugin supports multiple languages. Language files are included in the package: ```html <!-- Include language file --> <script src="node_modules/@gpaol/bootstrap-multiselect/src/langs/bootstrap-multiselect.it.min.js"></script> <!-- Set global language --> <script> $.fn.bootstrapMultiSelect.lang = 'it'; </script> ``` ### Available Languages - German (`de`) - Spanish (`es`) - French (`fr`) - Italian (`it`) - Portuguese (`pt`) For more details, see the [Localization Guide](https://github.com/gpaol/bootstrap-multiselect/blob/main/docs/LOCALIZATION-GUIDE.md). ## šŸ“š Documentation - **Complete Examples**: [PLUGIN-EXAMPLES.md](https://github.com/gpaol/bootstrap-multiselect/blob/main/docs/PLUGIN-EXAMPLES.md) - **Localization Guide**: [LOCALIZATION-GUIDE.md](https://github.com/gpaol/bootstrap-multiselect/blob/main/docs/LOCALIZATION-GUIDE.md) - **Main README**: [README.md](https://github.com/gpaol/bootstrap-multiselect/blob/main/README.md) ## ⚔ Features - āœ… **Bootstrap 5 Integration**: Full compatibility with Bootstrap 5 - āœ… **Search & Filtering**: Built-in search functionality - āœ… **Select All**: Convenient select/deselect all options - āœ… **Pagination**: Paginate long lists for better performance - āœ… **Grouped Options**: Support for optgroup elements - āœ… **Localization**: Multiple language support (DE, ES, FR, IT, PT) - āœ… **Responsive Design**: Works seamlessly on all devices - āœ… **Customizable**: Extensive configuration options - āœ… **Lightweight**: Minimal footprint, optimized performance ## šŸ“„ License MIT License - see [LICENSE](../../LICENSE) for details ## šŸ‘¤ Author Paolo Gaetano - GitHub: [@gpaol](https://github.com/gpaol) - Repository: [bootstrap-multiselect](https://github.com/gpaol/bootstrap-multiselect) ## šŸ¤ Contributing Contributions, issues, and feature requests are welcome! See the [Contributing Guide](https://github.com/gpaol/bootstrap-multiselect/blob/main/CONTRIBUTING.md) for detailed guidelines. ## šŸ”— Links - **Repository**: <https://github.com/gpaol/bootstrap-multiselect> - **Issues**: <https://github.com/gpaol/bootstrap-multiselect/issues> - **npm Package**: <https://www.npmjs.com/package/@gpaol/bootstrap-multiselect> - **CDN (jsDelivr)**: <https://cdn.jsdelivr.net/npm/@gpaol/bootstrap-multiselect@latest/> - **CDN (unpkg)**: <https://unpkg.com/@gpaol/bootstrap-multiselect@latest/> ## šŸ“‹ Requirements - Bootstrap 5.3.0 or higher - jQuery 3.7.0 or higher