API Reference

Complete reference for BlazorXSelect component properties, events, and methods

Core Parameters

Parameter Type Default Description
Value TValue? null The selected value (single-select mode)
ValueChanged EventCallback<TValue?> - Callback invoked when selection changes
Values IReadOnlyList<TValue>? null The selected values (multi-select mode)
ValuesChanged EventCallback<IReadOnlyList<TValue>> - Callback invoked when multi-selection changes
Items IEnumerable<TItem>? null Static list of items to display
ValueSelector Func<TItem, TValue> required Function to extract value from item
DisplaySelector Func<TItem, string> required Function to extract display text from item
Placeholder string? null Placeholder text when no selection
Disabled bool false Whether the component is disabled
ReadOnly bool false Whether the component is read-only

Multi-Select Parameters

Parameter Type Default Description
MultiSelect bool false Enable multi-select mode
MaxSelections int? null Maximum number of selections allowed
CloseOnSelect bool true (single), false (multi) Whether to close dropdown after selection
ShowChips bool true Show selected items as chips/tags
ChipStyle ChipStyle Default Visual style for chips (Default, Outlined, Filled)

Search Parameters

Parameter Type Default Description
Searchable bool false Enable search functionality
SearchPlaceholder string? "Search..." Placeholder for search input
SearchDebounceMs int 300 Debounce delay for search in milliseconds
CaseSensitiveSearch bool false Whether search is case-sensitive
SearchMechanism SearchMechanism Contains Search mechanism (Contains, StartsWith, Fuzzy)
SearchFields List<Func<TItem, string>>? null Additional fields to search in
MinSearchLength int 0 Minimum characters before triggering search

Async Data Loading Parameters

Parameter Type Default Description
DataProvider Func<DataRequest, Task<DataResponse<TItem>>>? null Function to load data asynchronously
LoadOnOpen bool true Load data when dropdown opens
PageSize int 20 Number of items per page
InfiniteScroll bool false Enable infinite scroll pagination
CacheEnabled bool false Enable caching of loaded data
CacheExpirationMinutes int 5 Cache expiration time in minutes

Virtualization Parameters

Parameter Type Default Description
EnableVirtualization bool false Enable virtual scrolling
VirtualizationThreshold int 100 Minimum items to enable virtualization
ItemHeight int 35 Height of each item in pixels
OverscanCount int 3 Number of items to render outside visible area

Grouping Parameters

Parameter Type Default Description
GroupBy Func<TItem, string>? null Function to group items
GroupsCollapsible bool false Allow collapsing group sections
GroupsInitiallyExpanded bool true Initial expansion state of groups

Templates

Template Context Description
ItemTemplate TItem Custom template for dropdown items
SelectedItemTemplate TItem Custom template for selected item display
TagTemplate TItem Custom template for multi-select tags
GroupHeaderTemplate string Custom template for group headers
NoDataTemplate - Template when no items available
LoadingTemplate - Template during async loading
ErrorTemplate string Template for error display

Events

Event Type Description
OnOpen EventCallback Fired when dropdown opens
OnClose EventCallback Fired when dropdown closes
OnSearchChanged EventCallback<string> Fired when search text changes
OnItemSelected EventCallback<TItem> Fired when an item is selected
OnItemDeselected EventCallback<TItem> Fired when an item is deselected
OnMaxSelectionsReached EventCallback Fired when max selections limit reached
OnLoadError EventCallback<Exception> Fired when data loading fails

Public Methods

Method Returns Description
OpenAsync() Task Programmatically open the dropdown
CloseAsync() Task Programmatically close the dropdown
RefreshAsync() Task Reload data from DataProvider
ClearAsync() Task Clear current selection
ClearCacheAsync() Task Clear cached data
FocusAsync() Task Set focus to the component