Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Select Icons

Security covered Maintenance fixes only 61 sites

This module allows developers to create custom select elements within Drupal's Form API that display icons next to each option. It uses jQuery UI to enhance the standard select functionality, enabling visual representation for choices.

This module provides a Form API select element with icons using jQuery UI.

This module is for developers only. It does not provide any user functionality.

With Select icons you can easily create select element with icons of your choice
using nothing but drupal Forms API and some CSS:

$form['fancy_select'] = [
  '#type' => 'select_icons',
  '#title' => $this->t('Color'),
  '#options' => [
    'r' => $this->t('Red'),
    'g' => $this->t('Green'),
    'b' => $this->t('Blue'),
  ],
  // This is where magic happens:
  // CSS classes from 'data-class' attribute are used in JavaScript
  // when building jQuery UI selectmenu widget.
  '#options_attributes' => [
    'r' => new Attribute(['data-class' => ['color', 'red']]),
    'g' => new Attribute(['data-class' => ['color', 'green']]),
    'b' => new Attribute(['data-class' => ['color', 'blue']]),
  ],
  // Don't forget to add proper CSS that will provide icons.
  // It is recommended to use sprite sheets for better performance.
  '#attached' => [ 'library' => ['my/colors'] ],
];

Requirements

Similar projects and how they are different

  • Select2 Boxes - Select2 Boxes integrates with Select2 library and provides field widget plugins while Select Icons integrates with jQuery UI and is for developer.

Maintainers

Previous maintainers

Drupal 11 · not 10

Ask your assistant about Select Icons

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

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
7
Tracked since
Jun 2023
Latest release
2 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.1.0 Stable 11 Jul 19, 2026
2.x-dev Dev 11 Jul 19, 2026
2.0.0 Stable 10–11 Jun 24, 2024
2.0.x-dev Dev 10–11 Jun 24, 2024
8.x-1.3 Stable 10–11 Jun 19, 2024
8.x-1.2 Stable 9–10 Feb 1, 2024
8.x-1.1 Stable 9–10 Jun 27, 2023