Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Drupal 11.4.6 Update released for Drupal core (11.4.6)! Release: Drupal 10.6.16 Update released for Drupal core (10.6.16)! Release: Drupal 12.0.0-alpha1 First alpha version released for Drupal core (12.0.0-alpha1). Release: AI (Artificial Intelligence) 1.5.0-rc3 New release candidate for module ai (1.5.0-rc3). Release: Smart Image Optimizer 1.0.1 Minor update available for module smart_image_optimizer (1.0.1). Release: EzContent API - Enhanced De-coupled CMS Experience 2.3.10 Minor update available for module ezcontent_api (2.3.10). Release: Collector Systems Gallery 1.0.11 Minor update available for module collector_systems (1.0.11). Release: EzContent API - Enhanced De-coupled CMS Experience 2.1.4 Minor update available for module ezcontent_api (2.1.4). Module Revived: EzContent API - Enhanced De-coupled CMS Experience 2.3.9 Module ezcontent_api updated after 15 months of inactivity (2.3.9). Security Coverage: Analyze PostHog Module analyze_posthog now has official Drupal security advisory coverage.

Select Icons

77 sites Security covered Drupal 11 · not 10
View on drupal.org

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

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
2
Tracked since
Jul 2026
Latest release
1 month ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
2.1.0 Stable 11 Jul 19, 2026
2.x-dev Dev 11 Jul 19, 2026