chosen.png

Chosen uses the Chosen jQuery plugin to make your <select> elements more user-friendly.

Usage

By default the module will automatically apply itself to any select elements that have more than 20 options, which is a reasonable default for which having Chosen will be useful. To change or disable this automatic enhancement, you can change the selectors (or remove all selectors) from the Apply Chosen to the following elements field on the Chosen administration page.

FAPI #chosen property
For developers, you can force the Chosen plugin to be applied or never applied to your select FAPI element by adding $element['#chosen'] = TRUE; or $element['#chosen'] = FALSE; respectively.

Field UI
You can force enable/disable Chosen for certain field widgets: Select list (for both list and date fields), and Select (or other) list. If you have a field using one of these widgets, in the field settings, you will find a Apply Chosen to the select fields in this widget? option with three values: Apply, Do not apply, or No preference (which will fall back to using the automatic application).

Installation via Composer for Drupal 9-10

If you are using Composer to manage your site's dependencies, then follow the instructions depending on your module version:
For version 3.x:
issue #3102250 comment #47.
For version 4.x:
The README contains all the information for the setup.

Update with Composer for Drupal 9-10

composer require drupal/chosen:[version] -W

for example:
composer require drupal/chosen:3.0.5 -W

Manual Installation

  1. Download the Chosen jQuery plugin.
  2. [Drupal 7] Extract the plugin under sites/all/libraries
  3. [Drupal 9-10] Extract the plugin under libraries/chosen.
  4. Download and enable the module.
  5. Configure at Administer > Configuration > User interface > Chosen (requires administer site configuration permission)

Installation via Drush

A Drush command is provided in the latest versions for easy installation of the Chosen plugin.

drush chosenplugin

The command will download the plugin and unpack it in the right folder.
It is possible to add another path as an option to the command, but not
recommended unless you know what you are doing.

Dependencies

The 7.x-2.0-alpha2 and 7.x-2.0-alpha4 releases added a dependency on the jQuery Update module. As of 7.x-2.0-beta1 this dependency has been removed.

The Drupal 9-10 version has no dependencies.

Documentation

Maintainers

Dave Reid
Hydra
Bálint Nagy

Related Modules

Chosen AJAX by Cristhian

Supporting organizations: 
Maintaining the Drupal 9/10 branch
Previously maintained the Drupal 8/9 branch
Initial development

Project information

Releases