--- # Feel free to add content and custom Front Matter to this file. # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults layout: default title: Introduction title_tag: false permalink: / ---

Get started with the Select2 Bootstrap 5 theme, the look of Bootstrap 5, with the functionality of Select2.

Quick start

Looking to quickly get started adding the Select2 Bootstrap 5 theme to your project? Use jsDelivr, a free open source CDN. Using a package manager or need to download the source files? Head to the download & install page.

Select2 v4.0.x

Copy the following link and script tags into your head to load Bootstrap 5, Select2 v4.0 and the Select2 Bootstrap 5 theme.

{% include clipboard.html %} {% highlight html %} {% endhighlight %}

Select2 v4.1.x

Copy the following link and script tags into your head to load Bootstrap 5, Select2 v4.1 and the Select2 Bootstrap 5 theme.

{% include clipboard.html %} {% highlight html %} {% endhighlight %}

Initialise Select2

Once the necessary styles and scripts are imported, Select2 can be initialised with the Select2 Bootstrap 5 theme. Simply set the theme parameter to bootstrap-5 as seen below.

{% include clipboard.html %} {% highlight js %} $( '#select-field' ).select2( { theme: 'bootstrap-5' } ); {% endhighlight %}

Browsers & devices

The Select2 Bootstrap 5 theme uses the same .browserlistrc specification that Bootstrap 5 uses, to ensure thorough compatibility between the browsers & devices supported by Bootstrap 5 and those supported by the Select2 Bootstrap 5 theme. For more information about what browsers and devices are supported, visit the Browsers and devices page in the Bootstrap 5 docs.

Accessibility

This Select2 theme is designed as much as possible to fit in with the accessibility features and limitations detailed by Bootstrap 5. This includes the guidance on color contrast and visually hidden content.