Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Slim Select

Security covered Under active development 52 sites

This module integrates the Slim Select library with Drupal's select form elements. It enhances standard select fields with features like searching and an option to group selections, allowing for a more interactive dropdown experience.

Integrates Slim Select with the select form element, converting it into a Slim Select HTML element. Allows users to add classes to the select options and perform search on them.

Homepage: www.drupal.org/project/slim_select
External library homepage: slimselectjs.com
Bugs and improvements: www.drupal.org/project/issues/slim_select

INSTALLATION

Preferred method: Slim Select is providing a package.json that can include the slim-select library. Make sure you have NPM of nodejs installed in your system and from the module folder, run npm install.
Alternatively, in your composer add the following script in your post-install-cmd scripts in order to install the dependencies with each composer install.

{
  "scripts": {
    "post-install-cmd": [
      "npm install -C web/modules/contrib/slim_select"
    ]
  }
}

In the script above, it is assumed that the slim_select module is installed in the web/modules/contrib directory as a relative path from the project root or where your composer.json is located. Adapt the path according to your installation.

Alternative methods:
Manually download and install the library in the libraries folder in the webroot, profile directory or site directory within drupal. The package should be placed as such, so that the path looks like <libraries path>/slim-select/dist/slimselect.min.js where <libraries path> is one of the directories mentioned above.

USAGE

In order to override the normal select element and display a Slim Select version, simply add a #slim_select property to the existing form element like below.

$form['my_slim_select'] = [
  '#type' => 'select'
  '#title' => 'A new select',
  '#options' => [
    'option1' => 'Red',
    'option2' => 'Green',
    'option3' => 'Blue',
  ],
  '#slim_select' => [
    'showSearch' => TRUE,
  ],
];

The #slim_select entry holds the configurable options of the Slim Select library. There are two configurable options currently supported as well.

  • showSearch: Controls whether there will be a search bar for looking up options in the select.
  • selectByGroup: When the select element accepts multiple options, if there are options grouped by an optgroup, then the optgroup becomes clickable, and clicking it selects automatically all children options.

Ask your assistant about Slim Select

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
May 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
1.0.0-beta2 Pre-release 10–11 May 20, 2025
1.0.0-beta1 Pre-release 10–11 Apr 4, 2025
1.0.0-alpha5 Pre-release 10–11 Feb 6, 2025
1.0.0-alpha4 Pre-release 9–10 Jan 11, 2024
1.0.0-alpha3 Pre-release 9–10 May 22, 2023