berkanakyurek / select2-bootstrap4-theme

A theme for Select2 v4 and Bootstrap 4
https://berkan52.github.io/select2-bootstrap4-theme/
MIT License
91 stars 41 forks source link
bootstrap4 css scss select2

Select2 Bootstrap4 Theme

select2-bootstrap4-theme version License

Compatibility

Tested with Bootstrap v4.1.1 and Select2 v4.0.6rc1 in latest Firefox, Chrome and Safari (Mac).

Installation

Usage

select2-bootstrap4-theme only works with Select2 v4.x. Applying the theme requires select2-bootstrap4.css referenced after the default select2.css that comes with Select2:

<link rel="stylesheet" href="https://github.com/berkanakyurek/select2-bootstrap4-theme/blob/master/select2.css">
<link rel="stylesheet" href="https://github.com/berkanakyurek/select2-bootstrap4-theme/blob/master/select2-bootstrap4.css">

To apply the theme, tell Select2 to do so by passing bootstrap to the theme option when initializing Select2:

$( "#dropdown" ).select2({
    theme: "bootstrap4"
});

You may also set it as the default theme for all Select2 widgets like so:

$.fn.select2.defaults.set( "theme", "bootstrap4" );

Changelog

Version 1.0.2
Version 1.0.1
Version 1.0.0

Copyright and license

The license is available within the repository in the LICENSE file.