Skip to content

Configuration Reference

All DotSelect configuration is done through HTML data attributes on the <select> element. This page provides a complete reference of every available attribute.

Core

AttributeDescriptionTypeDefault
data-dot-selectEnables DotSelect on the elementflag
data-placeholderPlaceholder text when no value is selectedstring""
data-searchableEnable the search inputbooleanfalse
data-allow-clearShow a clear button to reset the valuebooleanfalse
data-close-on-selectClose dropdown after selectionbooleantrue (single), false (multiple)
data-hide-selectedHide selected options from the dropdown (multiple mode)booleanfalse
data-max-itemsMaximum number of selections (multiple mode)numberInfinity
data-sizeComponent size: sm, md, lgstringmd
data-dirText direction: ltr, rtl, autostringauto
data-localeLocale identifier for i18n stringsstringen
data-open-on-focusOpen dropdown when the element receives focusbooleantrue
data-disabledDisable the select programmaticallybooleanfalse
data-loadingShow loading indicatorbooleanfalse
data-dropdown-parentCSS selector for the dropdown's parent containerstringnull
data-dropdown-positionDropdown position: auto, top, bottomstringauto
data-dropdown-classAdditional CSS class(es) for the dropdownstring""
data-wrapper-classAdditional CSS class(es) for the wrapperstring""

AJAX

AttributeDescriptionTypeDefault
data-ajax-urlURL to fetch options from (supports tokens)string
data-ajax-methodHTTP method for the requeststringGET
data-ajax-delayDebounce delay in millisecondsnumber300
data-ajax-min-charsMinimum characters before triggering AJAX searchnumber1
data-ajax-data-keyDot-notation path to the results array in the responsestringdata
data-ajax-cacheCache AJAX responsesbooleantrue
data-ajax-headersJSON string of custom HTTP headersstring"{}"
data-ajax-resolve-urlURL to resolve pre-selected IDs to full objectsstring
data-selectedComma-separated values to pre-select (used with AJAX)string

Field Mapping

AttributeDescriptionTypeDefault
data-option-idField name in AJAX response for the option valuestringid
data-option-textField name in AJAX response for the option labelstringtext
data-option-disabledField name for disabled statestringdisabled
data-option-groupField name for option groupingstringgroup

Templates

AttributeDescriptionTypeDefault
data-template-optionHTML template for dropdown optionsstring
data-template-itemHTML template for selected itemsstring
data-template-no-resultsHTML template when no results are foundstring
data-template-loadingHTML template for loading statestring

TIP

Templates use the {@field_name} token syntax. Any field from the option data can be referenced. For AJAX options, this includes all fields returned by the API.

Pagination

AttributeDescriptionTypeDefault
data-paginationEnable infinite-scroll paginationbooleanfalse
data-pagination-limitNumber of results per pagenumber20
data-pagination-more-keyDot-notation path to the "has more" flag in the responsestringpagination.more

Chaining

AttributeDescriptionTypeDefault
data-chain-groupName identifying the chain groupstring
data-chained-indexPosition in the chain (0-based)number
data-chained-child-dataJSON mapping of parent values to child optionsstring
data-chained-child-ajax-dataAJAX URL template for child options (uses {@val} for parent value)string
data-chained-disabled-on-emptyDisable when parent has no valuebooleantrue
data-chained-clear-on-parent-changeClear value when parent changesbooleantrue
data-chained-skip-emptySkip this level if no options are availablebooleanfalse

Plugins

AttributeDescriptionTypeDefault
data-pluginsComma-separated list of plugin names to activatestring""

Tagging

AttributeDescriptionTypeDefault
data-create-itemsAllow users to create new optionsbooleanfalse
data-create-items-textText for the "Add" prompt (supports {@term})stringAdd "{@term}"
data-create-items-patternRegex pattern for validating new valuesstring
data-tags-separatorSeparator character for the tags pluginstring,

Text Overrides

These attributes override locale strings for a specific element.

AttributeDescriptionTypeDefault
data-no-results-textText shown when no options matchstringLocale default
data-searching-textText shown during AJAX searchstringLocale default
data-load-more-textText for the "load more" pagination triggerstringLocale default
data-input-too-short-textText shown when input is below min-charsstringLocale default

Miscellaneous

AttributeDescriptionTypeDefault
data-tab-indexCustom tabindex for the controlnumber0
data-form-nameOverride the name attribute for form submissionstringElement's name
data-copy-classes-to-dropdownCopy the select element's classes to the dropdownbooleanfalse
data-render-option-content-as-htmlRender option template content as HTML (not escaped)booleanfalse
data-render-item-content-as-htmlRender item template content as HTML (not escaped)booleanfalse

WARNING

Setting data-render-option-content-as-html or data-render-item-content-as-html to true can expose your application to XSS attacks if the data is user-generated. Only enable this when you trust the source of the data.

MIT Licensed