Skip to content

Data Attributes Reference

A complete alphabetical reference of all HTML data attributes supported by DotSelect.

Quick Reference

AttributeDescriptionValues / TypeDefault
data-ajax-cacheCache AJAX responses to avoid duplicate requestsbooleantrue
data-ajax-data-keyDot-notation path to the results array in JSON responsestringdata
data-ajax-delayDebounce delay (ms) before sending AJAX requestnumber300
data-ajax-headersJSON-encoded custom HTTP headers for AJAX requestsstring (JSON)"{}"
data-ajax-methodHTTP method for AJAX requestsGET, POSTGET
data-ajax-min-charsMinimum characters typed before triggering AJAX searchnumber1
data-ajax-resolve-urlURL to resolve pre-selected AJAX values to full objectsstring (URL)
data-ajax-urlURL template for fetching options (supports tokens)string (URL)
data-allow-clearShow a clear button to reset the selectionbooleanfalse
data-chain-groupName linking selects into a chained groupstring
data-chained-child-ajax-dataAJAX URL template for loading child options based on parentstring (URL)
data-chained-child-dataJSON map of parent values to static child option arraysstring (JSON)
data-chained-clear-on-parent-changeClear this select when its parent value changesbooleantrue
data-chained-disabled-on-emptyDisable this select when the parent has no valuebooleantrue
data-chained-indexZero-based position of this select in its chain groupnumber
data-chained-skip-emptySkip this chain level if no options are availablebooleanfalse
data-close-on-selectClose the dropdown after a selection is madebooleantrue (single) / false (multi)
data-copy-classes-to-dropdownCopy the original element's CSS classes to the dropdownbooleanfalse
data-create-itemsAllow users to create new options by typingbooleanfalse
data-create-items-patternRegex pattern to validate user-created valuesstring (regex)
data-create-items-textPrompt text for creating new items (supports {@term})stringAdd "{@term}"
data-dirText direction for the componentltr, rtl, autoauto
data-disabledProgrammatically disable the selectbooleanfalse
data-dot-selectEnable DotSelect on this element (required)flag
data-dropdown-classAdditional CSS class(es) applied to the dropdownstring""
data-dropdown-parentCSS selector for the element the dropdown is appended tostring (selector)null
data-dropdown-positionForce dropdown positionauto, top, bottomauto
data-form-nameOverride the form submission name attributestringelement's name
data-hide-selectedHide already-selected options from the dropdownbooleanfalse
data-input-too-short-textOverride locale string for min-chars messagestringlocale default
data-load-more-textOverride locale string for pagination triggerstringlocale default
data-loadingShow the loading indicatorbooleanfalse
data-localeLocale identifier for UI stringsstringen
data-max-itemsMaximum number of items that can be selected (multiple mode)numberInfinity
data-no-results-textOverride locale string for "no results" messagestringlocale default
data-open-on-focusOpen the dropdown when the element receives focusbooleantrue
data-option-disabledAJAX response field name for option disabled statestringdisabled
data-option-groupAJAX response field name for option groupingstringgroup
data-option-idAJAX response field name for option valuestringid
data-option-textAJAX response field name for option display textstringtext
data-paginationEnable infinite-scroll pagination for AJAXbooleanfalse
data-pagination-limitNumber of results per pagenumber20
data-pagination-more-keyDot-notation path to "has more" flag in responsestringpagination.more
data-placeholderPlaceholder text when no option is selectedstring""
data-pluginsComma-separated list of plugins to activatestring""
data-render-item-content-as-htmlRender item template content as unescaped HTMLbooleanfalse
data-render-option-content-as-htmlRender option template content as unescaped HTMLbooleanfalse
data-searchableEnable the search/filter inputbooleanfalse
data-searching-textOverride locale string for "searching" messagestringlocale default
data-selectedComma-separated values to pre-select (for AJAX mode)string
data-sizeComponent size variantsm, md, lgmd
data-tab-indexCustom tabindex for the controlnumber0
data-tags-separatorSeparator character for the tags pluginstring,
data-template-itemHTML template for rendering selected itemsstring (HTML)
data-template-loadingHTML template for the loading statestring (HTML)
data-template-no-resultsHTML template for the "no results" statestring (HTML)
data-template-optionHTML template for rendering dropdown optionsstring (HTML)
data-wrapper-classAdditional CSS class(es) applied to the wrapper elementstring""

Boolean Attributes

Boolean attributes accept "true" or "false" as string values:

html
<!-- Enable -->
<select data-dot-select data-searchable="true">

<!-- Disable (same as omitting) -->
<select data-dot-select data-searchable="false">

TIP

The presence of a boolean attribute without a value is treated as "true":

html
<!-- These are equivalent -->
<select data-dot-select data-searchable="true">
<select data-dot-select data-searchable>

Token Syntax in Attributes

Several attributes support token replacement using the {@token} syntax:

TokenAvailable InDescription
{@term}AJAX URLs, templatesCurrent search query
{@page}AJAX URLsCurrent pagination page number
{@selected}AJAX URLsComma-separated currently selected values
{@val}Chained AJAX URLsParent select's current value
{@pagination_limit}AJAX URLsConfigured results per page
{@count}Text overridesNumeric value (e.g., min-chars count)
{@field_name}TemplatesAny field from option data

MIT Licensed