Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Datalist

272 sites Security covered
View on drupal.org

This module adds an HTML datalist form element to Drupal, providing a user-friendly and accessible alternative to traditional select fields by offering built-in search capabilities. It also includes a clear button, basic theming, and a Webform element, with a field type currently in development.

What does it do

Adds a form element for a HTML Datalist.
Adds an extra's "clear" field button and basic theming.

It works more or less the same as a select field but this has built in search capabilities.
This is actually better for accessibility and other use cases then for example select2 and others which aren't really accessible (even though they come close).

When providing options to datalist make sure it's an associative array. (Value => label)
The value will be submitted, the label is visible. (This can be tweaked via the use_keys settings).

A Webform element is also present.

A field type is in development.

Usage

<?php
 $form['list_of_xxx'] = array(
 *   '#type' => 'datalist',
 *   '#options' => [
        1 => 'Label 1',
      ],
 *   '#title' => 'Title',
 *   '#required' => TRUE,
 *   '#....
 * );
?>

Why?

For accessibility and UX reasons we've switched from select, select2 and others to HTML Datalist.

Supporting organizations

  • Federal Police Belgium

Activity

Total releases
2
First release
Jan 2025
Latest release
13 hours ago
Releases (12 mo)
1
Maintenance
Active

Releases

Version Type Release date
1.0.9 Stable Jul 17, 2026
1.0.8 Stable Jan 29, 2025