Configuration for default select2 settings / options

Created on 18 July 2022, almost 3 years ago
Updated 8 May 2025, about 2 months ago

Problem/Motivation

I don't like some default behavior of the select2 widget/filters and would love to have the possibility to change the default select2 settings for all usages of this module. For example, I think it's unnecessary to show the search box if the select element has less than 10 options.
The default setting for this in select2 is "minimumResultsForSearch" = 0.

Proposed resolution

As you don't override this option in your Select2 Element, I would love to have a module configuration page where I can set my own defaults that could be merged with your settings array.
I don't want to override the settings for every single field with a library that gets attached to the field as you described in the documentation. That's fine if I need to change the config for a single field but not to set the default config for all fields.

Feature request
Status

Active

Version

1.0

Component

Render element

Created by

🇩🇪Germany guido_s Cologne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024