MudBlazor

Community Support

Discord

GitHub Discussions

Tools and resources

TryMudBlazor

Templates

Sponsor

Open Collective


Switch to Blazor wasm
Toggle light/dark theme
GitHub repository
Toggle right-to-left/left-to-right

Community Support

Discord

GitHub Discussions

Tools and resources

TryMudBlazor

Templates

Sponsor

Open Collective

MudAutocomplete<T>

API documentation.

Check out the Examples for this component.

Properties

Name Type Default Description
Label String null If string has value the label text will be displayed in the input, and scaled down at the top if the input has value.
Placeholder String null The short hint displayed in the input before the user enters a value.
Direction Direction Direction.Bottom Sets the direction the Autocomplete menu should open.
OffsetX Boolean False If true, the Autocomplete menu will open either before or after the input (left/right).
OffsetY Boolean True If true, the Autocomplete menu will open either before or after the input (top/bottom).
Dense Boolean False If true, compact vertical padding will be applied to all Autocomplete items.
OpenIcon String "<path d="M0 0h24v24H0z" fill="none"/><path d="M7 10l5 5 5-5z"/>" The Open Autocomplete Icon
CloseIcon String "<path d="M0 0h24v24H0z" fill="none"/><path d="M7 14l5-5 5 5z"/>" The Close Autocomplete Icon
MaxHeight Int32 300 Sets the maxheight the Autocomplete can have when open.
ToStringFunc Func<T, String> null Defines how values are displayed in the drop-down list
SearchFunc Func<String, Task<IEnumerable<T>>> null The SearchFunc returns a list of items matching the typed text
MaxItems Nullable<Int32> 10 Maximum items to display, defaults to 10. Set null to display all
MinCharacters Int32 0 Minimum characters to initiate a search, defaults to 2
ResetValueOnEmptyText Boolean False Reset value if user deletes the text
DebounceInterval Int32 100 Debounce interval in milliseconds.
ItemTemplate RenderFragment<T> null Optional presentation template for unselected items
ItemSelectedTemplate RenderFragment<T> null Optional presentation template for the selected item
CoerceText Boolean True On drop-down close override Text with selected Value. This makes it clear to the user which list value is currently selected and disallows incomplete values in Text.
CoerceValue Boolean False If user input is not found by the search func and CoerceValue is set to true the user input will be applied to the Value which allows to validate it and display an error message.
IsOpenChanged EventCallback<Boolean> An event triggered when the state of IsOpen has changed
SelectValueOnTab Boolean False Set to true to select the currently selected item from the drop-down (if it is open)
Disabled Boolean False If true, the input element will be disabled.
ReadOnly Boolean False If true, the input will be read-only.
FullWidth Boolean False If true, the input will take up the full width of its container.
Immediate Boolean False If true, the input will update the Value immediately on typing. If false, the Value is updated only on Enter.
DisableUnderLine Boolean False If true, the input will not have an underline.
HelperText String null The HelperText will be displayed below the text field.
AdornmentIcon String null Icon that will be used if Adornment is set to Start or End.
AdornmentText String null Text that will be used if Adornment is set to Start or End, the Text overrides Icon.
Adornment Adornment Adornment.End Sets Start or End Adornment if not set to None.
AdornmentColor Color Color.Default The color of the adornment if used. It supports the theme colors.
IconSize Size Size.Medium Sets the Icon Size.
OnAdornmentClick EventCallback<MouseEventArgs> Button click event if set and Adornment used.
Clearable Boolean False Show clear button.
OnClearButtonClick EventCallback<MouseEventArgs> Button click event for clear button. Called after text and value has been cleared.
InputType InputType InputType.Text Type of the input element. It should be a valid HTML5 input type.
Variant Variant Variant.Text Variant to use.
Margin Margin Margin.None Will adjust vertical spacing.
AutoFocus Boolean False If true the input will focus automatically
Lines Int32 1 A multiline input (textarea) will be shown, if set to more than one line.
Text String null
TextChanged EventCallback<String>
OnBlur EventCallback<FocusEventArgs>
OnInternalInputChanged EventCallback<ChangeEventArgs>
OnKeyDown EventCallback<KeyboardEventArgs>
KeyDownPreventDefault Boolean False
OnKeyPress EventCallback<KeyboardEventArgs>
KeyPressPreventDefault Boolean False
OnKeyUp EventCallback<KeyboardEventArgs>
KeyUpPreventDefault Boolean False
ValueChanged EventCallback<T> Fired when the Value property changes.
Value T null The value of this input element. This property is two-way bindable.
Format String null Conversion format parameter for ToString(), can be used for formatting primitive types, DateTimes and TimeSpans
Required Boolean False If true, this form input is required to be filled out.
RequiredError String "Required" Set an error text that will be displayed if the input is not filled out but required!
ErrorText String null The ErrorText that will be displayed if Error true
Error Boolean False If true, the label will be displayed in an error state.
Converter Converter<T, String>
Culture CultureInfo
Validation Object null A validation func or a validation attribute. Supported types are: Func<T, bool> ... will output the standard error message "Invalid" if false Func<T, string> ... outputs the result as error message, no error if null Func<T, IEnumerable< string >> ... outputs all the returned error messages, no error if empty Func<T, Task< bool >> ... will output the standard error message "Invalid" if false Func<T, Task< string >> ... outputs the result as error message, no error if null Func<T, Task<IEnumerable< string >>> ... outputs all the returned error messages, no error if empty System.ComponentModel.DataAnnotations.ValidationAttribute instances
For Expression<Func<T>> null Specify an expression which returns the model's field for which validation messages should be displayed. Currently only string fields are supported.
Class String null User class names, separated by space
Style String null User styles, applied on top of the component's own classes and styles
Tag Object null Use Tag to attach any user data object to the component for your convenience.
UserAttributes Dictionary<String, Object> UserAttributes carries all attributes you add to the component that don't match any of its parameters. They will be splatted onto the underlying HTML tag.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙