Blazorise Autocomplete API
Explore the Blazorise Autocomplete API reference for parameters, events, methods, and related types.
For examples and usage guidance, see the Autocomplete documentation.
API
Parameters
| Parameter | Description | Type | Default |
|---|---|---|---|
AriaDescribedBy |
Specifies the aria-describedby attribute value. RemarksWhen set, this value is rendered as-is and overrides help and validation message ids generated by Field and Validation. |
string | |
AriaInvalid |
Specifies the aria-invalid attribute value. RemarksWhen set, this value is rendered as-is and overrides the validation-derived aria-invalid state. |
string | |
AriaLabelledBy |
Specifies the aria-labelledby attribute value. RemarksWhen set, this value is rendered as-is. Some non-labelable controls can otherwise derive it automatically from a parent FieldLabel or FieldsLabel. |
string | |
AriaRequired |
Specifies the aria-required attribute value. RemarksWhen set, this value overrides the required-field state resolved from the parent Validation. |
bool | false |
Autofocus |
Set's the focus to the component after the rendering is done. |
bool | false |
AutoPreSelect |
Determines whether Autocomplete auto preselects the first item displayed on the dropdown. Defauls to true. |
bool | true |
AutoSelectFirstItem |
Specifies the whether first item in the list should be selected |
bool | false |
ChildContent |
Specifies the content to be rendered inside this Autocomplete. |
RenderFragment | null |
CloseOnSelection |
Specifies whether Autocomplete dropdown closes on selection. This is only evaluated when multiple selection is set. Defauls to true. |
bool | true |
CloseParentDropdowns |
Specifies a value indicating whether parent dropdown menus should be closed when this component is activated. RemarksSet this property to to automatically close any open parent dropdowns when the component is triggered. This can be useful for ensuring only one dropdown is open at a time in nested menu scenarios. |
bool | false |
ConfirmKey |
Specifies an array of the keyboard pressed values for the ConfirmKey. If this is null or empty, there will be no confirmation key. Defauls to: { "Enter", "NumpadEnter", "Tab" }. RemarksIf the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in 'Key values'. |
string[] | new[] { "Enter", "NumpadEnter" } |
Data |
Specifies the autocomplete data source. |
IEnumerable<TItem> | null |
Debounce |
If true the entered text will be slightly delayed before submitting it to the internal value. |
bool? | null |
DebounceInterval |
Interval in milliseconds that entered text will be delayed from submitting to the internal value. |
int? | null |
Disabled |
Add the disabled boolean attribute on an input to prevent user interactions and make it appear lighter. |
bool | false |
Feedback |
Placeholder for validation messages. |
RenderFragment | null |
Filter |
Specifies the method by which the search will be done. Possible values: |
AutocompleteFilter | AutocompleteFilter.StartsWith |
FreeTyping |
Allows the value to not be on the data source. The value will be bound to the SelectedText |
bool | false |
FreeTypingNotFoundTemplate |
Specifies the not found content to be rendered inside this Autocomplete when no data is found and FreeTyping is enabled. |
RenderFragment<string> | null |
HighlightSearch |
If true, the searched text will be highlighted in the dropdown list items based on Search value. |
bool | false |
Immediate |
If true the text in will be changed after each key press. RemarksNote that setting this will override global settings in Immediate. |
bool? | null |
ItemContent |
Specifies the item content to be rendered inside each dropdown item. |
RenderFragment<ItemContext<TItem, TValue>> | null |
MaxEntryLength |
Specifies the maximum number of characters allowed in the input element. |
int? | null |
MaxMenuHeight |
Sets the maximum height of the dropdown menu. |
string | |
MinSearchLength |
The minimum number of characters a user must type before a search is performed. Set this to 0 to make the Autocomplete function like a dropdown. |
int | 1 |
MultipleBadgeColor |
Sets the Badge color for the multiple selection values. Used when multiple selection is set. |
Color | Primary |
MultipleDisabledBadgeColor |
Sets the disabled Badge color for the multiple selection values. Used when multiple selection is set. |
Color | Light |
NotFoundTemplate |
Specifies the not found template to be rendered inside this Autocomplete when no data is found. |
RenderFragment<string> | null |
Placeholder |
Sets the placeholder for the empty search. |
string | |
PositionStrategy |
Specifies the positioning strategy of the dropdown menu as a 'floating' element. Possible values: |
DropdownPositionStrategy | Absolute |
ReadOnly |
Add the readonly boolean attribute on an input to prevent modification of the input’s value. |
bool | false |
Search |
Specifies the currently selected item text. |
string | |
SearchBackground |
Specifies the background color of the search field. |
Background | null |
SearchClass |
Specifies class for search field. |
string | |
SearchStyle |
Specifies style for search field. |
string | |
SearchTextColor |
Specifies the text color of the search field. |
TextColor | null |
SelectedText |
Specifies the currently selected item text. |
string | |
SelectedTextExpression |
Specifies an expression that identifies the selected text. |
Expression<Func<string>> | null |
SelectedTexts |
Currently selected items texts. Used when multiple selection is set. |
List<string> | null |
SelectedTextsExpression |
Specifies an expression that identifies the selected texts. Used when multiple selection is set. |
Expression<Func<List<string>>> | null |
SelectedValue |
Currently selected item value. |
TValue | null |
SelectedValueExpression |
Specifies an expression that identifies the selected value. |
Expression<Func<TValue>> | null |
SelectedValues |
Currently selected items values. Used when multiple selection is set. |
List<TValue> | null |
SelectedValuesExpression |
Specifies an expression that identifies the selected values. Used when multiple selection is set. |
Expression<Func<List<TValue>>> | null |
SelectionMode |
Specifies the Autocomplete Selection Mode. Possible values: |
AutocompleteSelectionMode | AutocompleteSelectionMode.Default |
Size |
Sets the size of the input control. |
Size? | null |
SuggestSelectedItems |
Suggests already selected option(s) when presenting the options. |
bool | false |
TabIndex |
If defined, indicates that its element can be focused and can participates in sequential keyboard navigation. |
int? | null |
TagTemplate |
Specifies the content to be rendered for each tag (multiple selected item). |
RenderFragment<AutocompleteTagContext<TItem, TValue>> | null |
TotalItems |
Specifies the total number of items available when data is loaded through ReadData. RemarksThis field must be set only when ReadData and Virtualize is used to load the data. |
int? | null |
Value |
Specifies the value inside the input field. |
TValue | null |
ValueExpression |
Specifies an expression that identifies the input value. |
Expression<Func<TValue>> | null |
Virtualize |
Determines whether the Autocomplete will use the Virtualize functionality. |
bool | false |
Events
| Event | Description | Type |
|---|---|---|
Blur |
The blur event fires when an element has lost focus. |
EventCallback<FocusEventArgs> |
Closed |
Event handler used to detect when the autocomplete is closed. |
EventCallback<AutocompleteClosedEventArgs> |
CustomFilter |
Handler for custom filtering on Autocomplete's data source. |
Func<TItem, string, bool> |
CustomValidationValue |
Used to provide custom validation value on which the validation will be processed with the Validator handler. RemarksShould be used carefully as it's only meant for some special cases when input is used in a wrapper component, like Autocomplete or SelectList. |
Func<TValue> |
DisabledItem |
Method used to get the determine if the item should be disabled. |
Func<TItem, bool> |
FocusIn |
Notifies when the input box gains focus. |
EventCallback<FocusEventArgs> |
FocusOut |
Notifies when the input box loses focus. |
EventCallback<FocusEventArgs> |
KeyDown |
Notifies when a key is pressed down while the control has focus. |
EventCallback<KeyboardEventArgs> |
KeyPress |
Notifies when a key is pressed while the control has focus. |
EventCallback<KeyboardEventArgs> |
KeyUp |
Notifies when a key is released while the control has focus. |
EventCallback<KeyboardEventArgs> |
NotFound |
Occurs on every search text change where the data does not contain the text being searched. |
EventCallback<string> |
OnFocus |
Notifies when the input box gains or loses focus. |
EventCallback<FocusEventArgs> |
Opened |
Event handler used to detect when the autocomplete is opened. |
EventCallback |
ReadData |
Event handler used to load data manually based on the current search value. |
EventCallback<AutocompleteReadDataEventArgs> |
SearchBlur |
The blur event fires when the search box has lost focus. |
EventCallback<FocusEventArgs> |
SearchChanged |
Occurs on every search text change. |
EventCallback<string> |
SearchFocus |
Notifies when the search box gains or loses focus. |
EventCallback<FocusEventArgs> |
SearchKeyDown |
Notifies when a key is pressed down while the search box has focus. |
EventCallback<KeyboardEventArgs> |
SearchTextChanged |
Occurs after the search box text has changed. |
EventCallback<string> |
SelectedTextChanged |
Specifies the currently selected item text. |
EventCallback<string> |
SelectedTextsChanged |
Occurs after the selected texts have changed. Used when multiple selection is set. |
EventCallback<List<string>> |
SelectedValueChanged |
Occurs after the selected value has changed. |
EventCallback<TValue> |
SelectedValuesChanged |
Occurs after the selected values have changed. Used when multiple selection is set. |
EventCallback<List<TValue>> |
TextField |
Method used to get the display field from the supplied data source. |
Func<TItem, string> |
ValueChanged |
Occurs after value has changed. |
EventCallback<TValue> |
ValueField |
Method used to get the value field from the supplied data source. |
Func<TItem, TValue> |
Methods
| Method | Description | Return | Parameters |
|---|---|---|---|
AddMultipleTextAndValue |
Adds a Multiple Selection. | Task | TValue value |
Clear |
Clears the selected value and the search field. | Task | |
Close |
Closes the Autocomplete Dropdown. | Task | |
Close |
Closes the Autocomplete Dropdown. | Task | CloseReason closeReason |
GetItemByText |
Gets a | TItem | string text |
GetItemByValue |
Gets a | TItem | TValue value |
GetItemsByText |
Gets multiple items from Data by using the provided TextField. | IEnumerable<TItem> | string text |
IsSelectedItem |
Gets whether the | bool | TItem item |
IsSelectedvalue |
Gets whether the | bool | TValue value |
OpenDropdown |
Opens the Autocomplete Dropdown. | Task | |
Reload |
Triggers the reload of the Autocomplete data. Makes sure not to reload if the Autocomplete is in a loading state. | Task | CancellationToken cancellationToken |
RemoveMultipleTextAndValue |
Removes a Multiple Selection. | Task | string text |
RemoveMultipleTextAndValue |
Removes a Multiple Selection. | Task | TValue value |
ResetSelected |
Clears the current selection. | Task | |
ScrollItemIntoView |
Scrolls an item into view. | Task | int index |
Focus |
Sets the focus on the underline element. | Task | bool scrollToElement |
Revalidate |
Forces the Validation (if any is used) to re-validate with the new custom or internal value. | Task |