Autocomplete

The FluentAutocomplete component is not yet fully compatible with the EditForm and FluentEditForm elements. Some functionalities, such as error messages, the requirement message or the validation messages are missing.

Examples

Default

Example

Selected:

Auto Height
When the MaxAutoHeight attribute is set, the component adapts its height in relation to the selected elements.

Download: 

Customized options

Example

Selected:

ShowProgressIndicator

Download: 

Multiple == false

Example

Selected:

Download: 

Many Items

This example shows how you can use ImmediateDelay to control the delay between the user input and the search for options. A value of 0 means no delay

Example

Selected:

Download: 

Close via code

This example demonstrates how to close the dropdown in code.

Example

Selected:

Download: 

Different object instances from search results

By default the FluentAutocomplete component compares the search results by instance with it's internal selected items. You can control that behaviour by providing the OptionComparer parameter.

Example
Without OptionComparer:
With OptionComparer:
Download: 

Documentation

FluentAutocomplete<TOption> Class

Parameters

Name
Type
Default
Description
AppearanceFluentInputAppearance
Outline
Gets or sets the visual appearance. See Appearance
AriaLabelstring?
Gets or sets the text used on aria-label attribute.
AutoCompletestring?
Specifies whether a form or an input field should have autocomplete 'on' or 'off' or another value.
An Id value must be set to use this property.
Autofocusbool
False
Determines if the element should receive document focus on page load.
ChangeOnEnterOnlybool
False
Gets or sets whether using the up and down arrow keys should change focus and select immediately or that selection is done only on Enter.
⚠️ Only applicable in single select scenarios.
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
In this case list of FluentOptions
Disabledbool
False
Disables the form control, ensuring it doesn't participate in form submission.
DisplayNamestring?
Gets or sets the display name for this field.
This value is used when generating error messages when the input value fails to parse correctly.
Embeddedbool
False
Gets or sets if the derived component is embedded in another component.
If true, the ClassValue property will not include the EditContext's FieldCssClass.
FieldFieldIdentifier?
Gets or sets the FluentInputBase.FieldIdentifier that identifies the bound value.
If set, this parameter takes precedence over FluentInputBase.ValueExpression.
FooterContentRenderFragment<HeaderFooterContent<TOption>>?
Gets or sets the footer content, placed at the bottom of the popup panel.
HeaderContentRenderFragment<HeaderFooterContent<TOption>>?
Gets or sets the header content, placed at the top of the popup panel.
Heightstring?
Gets or sets the height of the component or of the popup panel.
IconDismissIcon?
Preview: 
Gets or sets the icon used for the Clear button. By default: Dismiss icon.
IconSearchIcon?
Preview: 
Gets or sets the icon used for the Search button. By default: Search icon.
Immediatebool
False
Change the content of this input field when the user write text (based on 'OnInput' HTML event).
ImmediateDelayint
0
Gets or sets the delay, in milliseconds, before to raise the FluentInputBase.ValueChanged event.
ItemsIEnumerable<TOption>?
Gets or sets the content source of all items to display in this list.
Each item must be instantiated (cannot be null).
ItemSizefloat
50
This is applicable only when using FluentAutocomplete.Virtualize. It defines an expected height in pixels for
each row, allowing the virtualization mechanism to fetch the correct number of items to match the display
size and to ensure accurate scrolling.
KeepOpenbool
False
Gets or sets whether the drop-down panel stays open after selecting an item,
until the number of selected items reaches the maximum (only using the mouse).
Labelstring?
Gets or sets the text to label the input.
This is usually displayed just above the input
LabelTemplateRenderFragment?
Gets or sets the content to label the input component.
This is usually displayed just above the input
MaxAutoHeightstring?
Gets or sets the maximum height of the field to adjust its height in relation to selected elements.
MaximumOptionsSearchint
9
Gets or sets the number of maximum options (items) returned by FluentAutocomplete.OnOptionsSearch.
Default value is 9.
MaximumSelectedOptionsint?
Gets or sets the maximum number of options (items) selected.
Exceeding this value requires the user to delete some elements in order to select new ones.
See the FluentAutocomplete.MaximumSelectedOptionsMessage.
MaximumSelectedOptionsMessageRenderFragment?
Gets or sets the message displayed when the FluentAutocomplete.MaximumSelectedOptions is reached.
Multiplebool
True
If true, the user can select multiple elements.
⚠️ Only available for the FluentSelect and FluentListbox components.
Namestring?
Gets or sets the name of the element.
Allows access by name from the associated form.
⚠️ This value needs to be set manually for SSR scenarios to work correctly.
OptionClassstring?
Gets or sets the css class applied to all FluentOption of the component.
OptionComparerIEqualityComparer<TOption>?
Gets or sets the Generic.IEqualityComparer used to determine if an option is already added to the internal list.
⚠️ Only available when Multiple = true.
OptionDisabledFunc<TOption, bool>?
Gets or sets the function used to determine if an option is disabled.
OptionSelectedFunc<TOption, bool>?
Gets or sets the function used to determine if an option is initially selected.
OptionStylestring?
Gets or sets the style applied to all FluentOption of the component.
OptionTemplateRenderFragment<TOption>?
Gets or sets the template for the ListComponentBase.Items items.
OptionTextFunc<TOption, string>
Gets or sets the function used to determine which text to display for each option.
OptionValueFunc<TOption, string>
Gets or sets the function used to determine which value to return for the selected item.
Only for FluentListbox and FluentSelect components.
Placeholderstring?
Gets or sets the short hint displayed in the input before the user enters a value.
PositionSelectPosition?
Gets or sets the position of the options popup.
ReadOnlybool
False
When true, the control will be immutable by user interaction. readonly HTML attribute for more information.
Requiredbool
False
Gets or sets a value indicating whether the element needs to have a value.
SelectedOptionTOption?
Gets or sets the selected item.
⚠️ Only available when Multiple = false.
SelectedOptionExpressionExpression<Func<TOption>>?
Gets or sets an expression that identifies the bound selected options.
⚠️ Only available when Multiple = false.
SelectedOptionsIEnumerable<TOption>?
Gets or sets all selected items.
⚠️ Only available when Multiple = true.
SelectedOptionsExpressionExpression<Func<IEnumerable<TOption>>>?
Gets or sets an expression that identifies the bound selected options.
⚠️ Only available when Multiple = true.
SelectedOptionTemplateRenderFragment<TOption>?
Gets or sets the template for the ListComponentBase.SelectedOptions items.
SelectValueOnTabbool
False
Gets or sets whether the currently selected item from the drop-down (if it is open) is selected.
Default is false.
ShowOverlayOnEmptyResultsbool
True
Gets or sets whether the dropdown is shown when there are no items.
ShowProgressIndicatorbool
False
Gets or sets whether the component will display a progress indicator while fetching data.
A progress ring will be shown ad the end of the component, when the FluentAutocomplete.OnOptionsSearch is invoked.
You can customize the progress indicator by using the FluentAutocomplete.HeaderContent or FluentAutocomplete.FooterContent parameters: see HeaderFooterContent.InProgress.
Titlestring?
Gets or sets the text used on aria-label attribute.
TitleScrollToNextstring
Next
Gets or sets the title and Aria-Label for the Scroll to next button.
TitleScrollToPreviousstring
Previous
Gets or sets the title and Aria-Label for the Scroll to previous button.
Valuestring?
Gets or sets the value of the input. This should be used with two-way binding.
For the FluentAutocomplete component, use the FluentAutocomplete.ValueText property instead.
ValueExpressionExpression<Func<string>>?
Gets or sets an expression that identifies the bound value.
ValueTextstring
Gets or sets the text field value.
Virtualizebool
False
If true, the options list will be rendered with virtualization. This is normally used in conjunction with
scrolling and causes the option list to fetch and render only the data around the current scroll viewport.
This can greatly improve the performance when scrolling through large data sets.

If you use FluentAutocomplete.Virtualize, you should supply a value for FluentAutocomplete.ItemSize and must
ensure that every row renders with the same constant height.

Generally it's preferable not to use FluentAutocomplete.Virtualize if the amount of data being rendered is small.
Widthstring?
100%
Gets or sets the width of the component.

EventCallbacks

Name
Type
Description
OnOptionsSearchEventCallback<OptionsSearchEventArgs<TOption>>
Filter the list of options (items), using the text encoded by the user.
SelectedOptionChangedEventCallback<TOption>
Called whenever the selection changed.
⚠️ Only available when Multiple = false.
SelectedOptionsChangedEventCallback<IEnumerable<TOption>>
Called whenever the selection changed.
⚠️ Only available when Multiple = true.
ValueChangedEventCallback<string>
Gets or sets a callback that updates the bound value.
ValueTextChangedEventCallback<string>
Gets or sets the callback that is invoked when the text field value changes.

Methods

Name
Parameters
Type
Description
CloseDropdownAsyncTask
Closes the multiselect dropdown.
DisposeAsyncValueTask
FocusAsyncvoid
Exposes the elements FocusAsync(bool preventScroll) method.
FocusAsyncbool preventScroll
void
Exposes the elements FocusAsync(bool preventScroll) method.
InvokeOptionsSearchAsyncTask
Performs the search operation and displays the available values. The search takes into account any previously
entered text which has updated the FluentAutocomplete.ValueText.
RemoveSelectedItemAsyncTOption item
Task

FluentPersona Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
Gets or sets the content to display under the FluentPersona.Name.
DismissTitlestring?
Gets or sets the title of the dismiss button.
Imagestring?
Gets or sets the image to display, in replacement of the initials.
ImageSizestring?
Gets or sets the size of the image.
Initialsstring?
Gets or sets the initials to display if no image is provided.
By default, the first letters of the FluentPersona.Name is used.
Namestring
Gets or sets the name to display.
StatusPresenceStatus?
Gets or sets the status to show. See PresenceStatus for options.
StatusSizePresenceBadgeSize
ExtraSmall
Gets or sets the FluentPersona.Status size to use.
Default is ExtraSmall.
StatusTitlestring?
Gets or sets the title to show on hover. If not provided, the status will be used.
TextPositionTextPosition
End
Gets or sets the TextPosition of the text.
Default is End.

EventCallbacks

Name
Type
Description
OnClickEventCallback<MouseEventArgs>
Gets or sets the event raised when the user clicks on this Persona.
OnDismissClickEventCallback
Gets or sets the event raised when the user clicks on the dismiss button.

Accessibility

This component is compatible with accessibility rules.
Except this Invalid ARIA attribute value: aria-controls="[id]-popup" when the list is expanded (will be solved later).
You can customize these 3 messages to be read by screen readers
  • FluentAutocomplete.AccessibilitySelected = "Selected {0}" List of selected items.
  • FluentAutocomplete.AccessibilityNotFound = "No items found" When the search criteria returns an empty list.
  • FluentAutocomplete.AccessibilityReachedMaxItems = "The maximum number of selected items has been reached." When the maximum number of selected items has been reached.
Filled
Outline
Above
Below
Busy
OutOfOffice
Away
Available
Offline
DoNotDisturb
Unknown
Tiny
ExtraSmall
Small
Medium
Large
End
Start
Regular.Size16.Dismiss
Regular.Size16.Search
An error has occurred. This application may no longer respond until reloaded. Reload 🗙