Integrates Drupal autocomplete and select fields with the Select2 jQuery library.

After installing Select2 module you can attach Select2 plugin for all selects form elements (on front-end pages and admin pages, if needed) by defining settings on Select2 module config page, you can also define exludion rules for disabling Select2 plugin attaching for some elements by:

  • ID,
  • CSS classes,
  • jQuery selector rules.

For attaching Select2 plugin to form element by Forms API you must define #select2 attribute in element array.

'products_categories' => array(
  '#title' => t('Element title'),
  '#type'     => 'select',
  '#options' => array(),
  '#empty_option' => t('Select element'),
  '#multiple'     => 1,
  '#select2' => array(),

Code abowe will atach Select2 plugin for select element with default properties values, in '#select2' array you can define all properties from Select2 documentation, that accepts non-function value (string, int, object etc):

'#select2' => array(
  'width' => '150',
  'placeholder' => 'Placeholder text',
  'allowClear'   => TRUE,

Also you can individually enable Select2 attaching for fields by setting options in "SELECT2 INTEGRATION SETTINGS" fieldset (if it available for current field) on field configuration page.


  • Libraries (7.x-2.1 or higher)
  • jQuery >= 1.7.2

Installation instructions

Install (or update if needed) and/or enable:

  • libraries (7.x-2.1 or higher) module

Download Select2 plugin (3.5.4) and extract it to sites/all/libraries/select2, you can use drush command "select2-download" for downloading Select2 plugin from repository:

drush select2-download

for download Select2 3.5.4 version and store it to sites/all/libraries/select2

drush select2-download --tag=master

for download Select2 from curent master branch

You can define custom settings on admin/config/user-interface/select2integration_settings page.

Known issues

Select2 branch 4.x isn't yet supported.

Please use 3.5.4 version of Select2 plugin -


  • This project is developed by IM.

Project Information