The settings object allows you to customize the behavior and appearance of the dropdown. All fields are optional. Key settings include:
showSearch: Enables/disables the search bar.searchPlaceholder: Text for the search input.modal: Controls mobile/modal behavior ('off' | 'on' | 'mobile').allowDeselect: Enables/disables clearing the selection.minSelected / maxSelected: Limits for multi-select.contentPosition: 'absolute' | 'relative' | 'fixed'.closeOnSelect: Boolean.
Example Configuration:
new SlimSelect({
select: '#selectElement',
settings: {
disabled: false,
alwaysOpen: false,
showSearch: true,
focusSearch: true,
keepSearch: false,
ariaLabel: 'Combobox',
searchPlaceholder: 'Search...',
searchText: 'No Results',
searchingText: 'Searching...',
resultsText: '{count} results available',
deselectText: 'Clear',
removeText: 'Remove',
searchHighlight: false,
closeOnSelect: true,
contentLocation: document.body,
contentPosition: 'absolute',
contentWidth: '',
openPosition: 'auto',
placeholderText: 'Select Value',
allowDeselect: false,
hideSelected: false,
multiString: false,
keepOrder: false,
showOptionTooltips: false,
minSelected: 0,
maxSelected: 1000,
timeoutDelay: 200,
maxValuesShown: 20,
maxValuesMessage: '{number} selected',
addableText: 'Press "Enter" to add {value}',
modal: 'mobile',
modalTitle: ''
}
})