1
0
mirror of synced 2024-11-23 13:36:01 +03:00
select2/pages/02.configuration/01.options-api/docs.md
2017-09-03 22:23:13 -04:00

4.2 KiB

title taxonomy
Configuration API
category
docs

The following is an attempt to provide a comprehensive list of all configuration options available in Select2.

Option Type Default Description
adaptContainerCssClass
adaptDropdownCssClass
ajax object null Provides support for ajax data sources.
allowClear boolean false Provides support for clearable selections.
amdBase string select2/ The base AMD loader path to be used for select2 dependency resolution. This option typically doesn't need to be changed, but is available for situations where module names may change as a result of certain build environments.
amdLanguageBase string select2/i18n/ The base AMD loader language path to be used for select2 language file resolution. This option typically doesn't need to be changed, but is available for situations where module names may change as a result of certain build environments.
closeOnSelect boolean true Controls whether the dropdown is closed after a selection is made.
containerCss
containerCssClass
dataAdapter SelectAdapter Used to override the built-in DataAdapter.
debug boolean
dir
disabled boolean false When set to true, the select control will be disabled.
dropdownAdapter DropdownAdapter Used to override the built-in DropdownAdapter
dropdownAutoWidth boolean
dropdownCss string
dropdownCssClass string
dropdownParent jQuery selector or DOM node Allows you to customize placement of the dropdown.
escapeMarkup
initSelection callback See initSelection. This option was deprecated in Select2 v4.0, and will be removed in v4.1.
language string or object
matcher A callback taking search params and the data object.
maximumInputLength integer 0 Maximum number of characters that may be provided for a search term.
maximumSelectionLength integer 0 The maximum number of items that may be selected in a multi-select control. If the value of this option is less than 1, the number of selected items will not be limited.
minimumInputLength integer 0 Minimum number of characters required to start a search.
minimumResultsForSearch integer 0 The minimum number of results required to display the search box.
multiple boolean false This option enables multi-select (pillbox) mode. Select2 will automatically map the value of the multiple HTML attribute to this option during initialization.
placeholder string or object
query A function taking params (including a callback) This option was deprecated in Select2 v4.0, and will be removed in v4.1.
resultsAdapter ResultsAdapter Used to override the built-in ResultsAdapter.
selectionAdapter SingleSelection or MultipleSelection, depending on the value of multiple. Used to override the built-in SelectionAdapter.
selectOnClose boolean false Implements automatic selection when the dropdown is closed.
sorter function
tags boolean / array of objects false Used to enable free text responses.
templateResult callback
templateSelection callback
theme string default Allows you to set the theme.
tokenizer
tokenSeparators
width string resolve Supports customization of the container width.