MudBlazor

MudSelect<T> API

Pages

Properties

Name Type Default Description
AnchorOrigin
Origin

Origin.TopCenter

Set the anchor origin point to determen where the popover will open from.
CheckedIcon
String
Custom checked icon.
ChildContent
RenderFragment

null

Add the MudSelectItems here
Clearable
Boolean

False

Show clear button.
CloseIcon
String
The Close Select Icon
Delimiter
String

", "

Parameter to define the delimited string separator.
Dense
Boolean

False

If true, compact vertical padding will be applied to all Select items.
IndeterminateIcon
String
Custom indeterminate icon.
LockScroll
Boolean

False

If true, prevent scrolling while dropdown is open.
MaxHeight
Int32

300

Sets the maxheight the Select can have when open.
MultiSelection
Boolean

False

If true, multiple values can be selected via checkboxes which are automatically shown in the dropdown
MultiSelectionTextFunc
Func<List<String>, String>

null

Function to define a customized multiselection text.
OpenIcon
String
The Open Select Icon
PopoverClass
String

null

User class names for the popover, separated by space
SelectAll
Boolean

False

If set to true and the MultiSelection option is set to true, a "select all" checkbox is added at the top of the list of items.
SelectAllText
String

"Select all"

Define the text of the Select All option.
SelectedValues
IEnumerable<T>

Set of selected values. If MultiSelection is false it will only ever contain a single value. This property is two-way bindable.
Strict
Boolean

False

If true, the Select's input will not show any values that are not defined in the dropdown. This can be useful if Value is bound to a variable which is initialized to a value which is not in the list and you want the Select to show the label / placeholder instead.
ToStringFunc
Func<T, String>

Defines how values are displayed in the drop-down list
TransformOrigin
Origin

Origin.TopCenter

Sets the transform origin point for the popover.
UncheckedIcon
String
Custom unchecked icon.
Inherited from MudBaseInput<T>
Adornment
Adornment

Adornment.End

The Adornment if used. By default, it is set to None.
AdornmentColor
Color

Color.Default

The color of the adornment if used. It supports the theme colors.
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.
AutoFocus
Boolean

False

If true the input will focus automatically.
Counter
Nullable<Int32>

null

If set, will display the counter, value 0 will display current count but no stop count.
Disabled
Boolean

False

If true, the input element will be disabled.
DisableUnderLine
Boolean

False

If true, the input will not have an underline.
Format
String

null

Conversion format parameter for ToString(), can be used for formatting primitive types, DateTimes and TimeSpans
FullWidth
Boolean

False

If true, the input will take up the full width of its container.
HelperText
String

null

The HelperText will be displayed below the text field.
HelperTextOnFocus
Boolean

False

If true, the helper text will only be visible on focus.
IconSize
Size

Size.Medium

The Icon Size.
Immediate
Boolean

False

If true, the input will update the Value immediately on typing. If false, the Value is updated only on Enter.
InputMode
InputMode

InputMode.text

Hints at the type of data that might be entered by the user while editing the input
KeyDownPreventDefault
Boolean

False

Prevent the default action for the KeyDown event.
KeyPressPreventDefault
Boolean

False

Prevent the default action for the KeyPress event.
KeyUpPreventDefault
Boolean

False

Prevent the default action for the KeyUp event.
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.
Lines
Int32

1

A multiline input (textarea) will be shown, if set to more than one line.
Margin
Margin

Margin.None

Will adjust vertical spacing.
MaxLength
Int32

524288

Maximum number of characters that the input will accept
Pattern
String

null

The pattern attribute, when specified, is a regular expression which the input's value must match in order for the value to pass constraint validation. It must be a valid JavaScript regular expression Not Supported in multline input
Placeholder
String

null

The short hint displayed in the input before the user enters a value.
ReadOnly
Boolean

False

If true, the input will be read-only.
Text
String

null

The text to be displayed.
TextUpdateSuppression
Boolean

True

When TextUpdateSuppression is true (which is default) the text can not be updated by bindings while the component is focused in BSS (not WASM). This solves issue #1012: Textfield swallowing chars when typing rapidly If you need to update the input's text while it is focused you can set this parameter to false. Note: on WASM text update suppression is not active, so this parameter has no effect.
Value
T

null

The value of this input element.
Variant
Variant

Variant.Text

Variant to use.
Inherited from MudFormComponent<T, String>
Converter
Converter<T, String>

The generic converter of the component.
Culture
CultureInfo

The culture of the component.
Error
Boolean

False

If true, the label will be displayed in an error state.
ErrorText
String

null

The ErrorText that will be displayed if Error true.
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.
Required
Boolean

False

If true, this form input is required to be filled out.
RequiredError
String

"Required"

The error text that will be displayed if the input is not filled out but required.
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<object, string, IEnumerable< string >> input Form.Model, Full Path of Member ... 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 Func<object, string, Task<IEnumerable< string >>> input Form.Model, Full Path of Member ... outputs all the returned error messages, no error if empty System.ComponentModel.DataAnnotations.ValidationAttribute instances
Inherited from MudComponentBase
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.

EventCallbacks

Name Type Description
OnAdornmentClick
EventCallback<MouseEventArgs>
Button click event if set and Adornment used.
OnBlur
EventCallback<FocusEventArgs>
Fired when the element loses focus.
OnClearButtonClick
EventCallback<MouseEventArgs>
Button click event for clear button. Called after text and value has been cleared.
OnInternalInputChanged
EventCallback<ChangeEventArgs>
Fired when the element changes internally its text value.
OnKeyDown
EventCallback<KeyboardEventArgs>
Fired on the KeyDown event.
OnKeyPress
EventCallback<KeyboardEventArgs>
Fired on the KeyPress event.
OnKeyUp
EventCallback<KeyboardEventArgs>
Fired on the KeyUp event.
SelectedValuesChanged
EventCallback<IEnumerable<T>>
Fires when SelectedValues changes.
TextChanged
EventCallback<String>
Fired when the text value changes.
ValueChanged
EventCallback<T>
Fired when the Value property changes.

Methods

Name Parameters Return Description
CheckGenericTypeMatch(object select_item)
object select_item
Task Clear()
Task
Clear the selection
Task CloseMenu(bool focusAgain)
bool focusAgain
Task
ValueTask FocusAsync()
ValueTask
ForceRender(bool forceTextUpdate)
bool forceTextUpdate
string GetErrorText()
string : Error text/message
Return the validation error text or the conversion error message.
Task OpenMenu()
Task
RegisterShadowItem(MudSelectItem<T> item)
MudSelectItem<T> item
Reset() Reset the value and the validation.
ResetValidation() Reset the validation.
ValueTask SelectAsync()
ValueTask
Task SelectOption(int index)
int index
Task
Task SelectOption(object obj)
object obj
Task
ValueTask SelectRangeAsync(int pos1, int pos2)
int pos1
int pos2
ValueTask
Task ToggleMenu()
Task
UnregisterShadowItem(MudSelectItem<T> item)
MudSelectItem<T> item
Task Validate()
Task
Cause this component to validate its value.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙