TextBox Blazor API

TextBox Properties

NameTypeDefaultDescription
AutoFocusboolfalseDetermines whether the text box will be focused on page load or not.
AutoCompleteAutoCompleteAutoComplete.ManualDetermines the autocomplete mode. Auto complete modes filter the items from the dataSource and show only those that match the input.
AutoCompleteDelayint100Determines the delay before the drop down opens to show the matches from the auto complete operation.
DataSourceobjectN/ADetermines the data source that will be loaded to the ComboBox. The dataSource can be an array of strings, numbers or objects where the attributes represent the properties of a List Item. For example label, value. It can also be a callback that returns an Array of items as previously described.
DisabledboolfalseEnables or disables the element.
DisplayLoadingIndicatorboolfalseDetermines whether an indicator will appear during filtering and remote item loading.
DisplayMemberstring""Sets or gets the displayMember. The displayMember specifies the name of a property to display. The name is contained in the collection specified by the 'dataSource' property.
DisplayModeTextBoxDisplayModeTextBoxDisplayMode.DefaultDetermines how the characters are displayed inside the input.
DropDownAppendToobjectN/ADetermines the drop down parent. The drop down can be removed from the body of the element and continue to work in another container. This is usefull when one of the parents of the element doesn't allow overflowing, by settings this property to 'body' the drop down will be appended to the DOM and the drop down will open/close as usual. dropDownAppendTo can be a string representing the id of an HTML element on the page or a direct reference to that element. Reseting it back to null will take the drop down back to it's original place.
DropDownHeightobjectSets the height of the drop down. By default it's set to an empty string. In this case the height of the drop down is controlled by a CSS variable.
DropDownMaxHeightobjectSets the maximum Height of the drop down. By default it's set to an empty string. In this case the maxHeight of the drop down is controlled by a CSS variable.
DropDownMaxWidthobjectSets the maximum Width of the drop down. By default it's set to an empty string. In this case the maxWidth of the drop down is controlled by a CSS variable.
DropDownMinHeightobjectSets the minimum Height of the drop down. By default it's set to an empty string. In this case the minHeight of the drop down is controlled by a CSS variable.
DropDownMinWidthobjectSets the minimum Width of the drop down. By default it's set to an empty string. In this case the minWidth of the drop down is controlled by a CSS variable.
DropDownOpenModeDropDownOpenModeDropDownOpenMode.DefaultDetermines how the drop down is going to open.
DropDownOverlayboolfalseIf this property is enabled, when the element's dropdown is opened, a transparent overlay is positioned between the dropdown and the rest of the document. The purpose of the overlay is to make sure that clicking anywhere outside the drop down will will target the overlay and not the DOM.
DropDownPlaceholderstring"No Items"Determines the placeholder for the drop down, displayed when there are no items in it.
DropDownPositionDropDownPositionDropDownPosition.AutoDetermines the position of the drop down when opened.
DropDownWidthobjectSets the width of the drop down. By default it's set to an empty string. In this case the width of the drop down is controlled by a CSS variable.
EscKeyModeEscKeyModeEscKeyMode.NoneDetermines the behavior of the element when Escape key is pressed.
EnterKeyBehaviorEnterKeyBehaviorEnterKeyBehavior.SubmitSpecifies the behavior of "Enter" key.
Formstring""The form element that the element is associated with (its "form owner"). The value of the attribute must be the ID of a form element in the same document.
HintobjectN/ASets additional helper text below the element. The hint is visible only when the element is focused.
HorizontalScrollBarVisibilityHorizontalScrollBarVisibilityHorizontalScrollBarVisibility.AutoDetermines the visibility of the horizontal Scroll bar thats inside the drop down.
InputMemberstring""Represents the property name of a List item. Determines the value of the input when a ListItem is selected. Usefull in cases where the user wants to display for example the value of an item instead of it's label. By default the label is displayed in the input.
InputPurposestring"off"Sets the purpose of the input and what, if any, permission the user agent has to provide automated assistance in filling out the element's input when in a form, as well as guidance to the browser as to the type of information expected in the element. This value corresponds to the standard HTML autocomplete attribute and can be set to values such as 'on', 'name', 'organization', 'street-address', etc.
ItemHeightint?N/ASets the height for all list items. Used only when virtualization is enabled.
ItemMeasureModeListItemMeasureModeListItemMeasureMode.AutoDetermines the item width measuring algorithm.
ItemsIEnumerable<object>A getter that returns an array of all List items inside the drop down.
ItemTemplateobjectN/AThe itemTemplate property is a string that represents the id of an HTMLTemplateElement in the DOM. It's used to set a customize the content of the list items.
Labelstring""Sets a little text label above the element.
LoadingIndicatorPlaceholderstring"Loading..."Determines the text that will be displayed next to the loading indicator when the loader is visible and it's position is top or bottom.
LoadingIndicatorPositionVerticalAlignmentVerticalAlignment.CenterDetermines the position of the loading indicator.
Localestring"en"Sets or gets the language. Used in conjunction with the property messages.
MaxLengthintN/ASets or gets the maximum number of characters that the user can enter.
MinLengthint2Sets or gets the minimum number of characters that the user have to enter to trigger the auto complete functionality.
MessagesobjectN/ASets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property language.
Namestring""Sets or gets the name attribute for the element. Name is used when submiting HTML forms.
IsOpenedboolfalseDetermines whether the drop down is opened or closed
Placeholderstring""Determines the input's placeholder.
ReadonlyboolfalseDisables user interaction with the element.
RightToLeftboolfalseSets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
RequiredboolfalseSpecifies that the user must fill the input before submitting a form with the element.
RequiredMessagestring""Specifies the message that will appear if required is set and no value is provided in the input.
SelectAllOnFocusboolfalseDetermines whether the content of the input will be selected on focus or not.
Themestring""Determines the theme. Theme defines the look of the element
UnfocusableboolfalseIf is set to true, the element cannot be focused.
Valuestring""Sets or gets the value of the element.
ValueMemberstring""Determines the value member of an item. Stored as value in the item object. Similar to groupMember, valueMember is especially usefull when using data from a JSON file as a dataSource for the ListBox and there's a specific property that should be used for the value the items.
VerticalScrollBarVisibilityVerticalScrollBarVisibilityVerticalScrollBarVisibility.AutoDetermines the visibility of the vertical scroll bar that's inside the drop down.

TextBox Methods

NameTypeArgumentsDescription
ClosevoidN/ACloses the drop down. "The drop down is used only when auto complete is enabled."
GetDataSourceAsync()Task<IEnumerable<object>>'N/A'Gets the &quot;DataSource&quot; property as Task&lt;IEnumerable&lt;object&gt;&gt;.
GetIsOpenedAsync()Task<bool>'N/A'Gets the &quot;IsOpened&quot; property as Task&lt;bool&gt;.
GetValueAsync()Task<string>'N/A'Gets the &quot;Value&quot; property as Task&lt;string&gt;.
OpenvoidN/AOpens the drop down. "The drop down is used only when auto complete is enabled."
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
ResetvoidN/AThe method is used to reset the input back to it's initial value.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.

TextBox Events

NameTypeDescriptionEvent Detail
OnChangeEventCallback<Event>This event is triggered when the value of the Text Box is changed. This happens on blur and if 'Enter' is pressed.dynamic oldValue- The previous value before it was changed., dynamic value- The new value., dynamic type- The type of the event.
Changedevent TextBoxChangedEventHandlerThis event is triggered when the value of the Text Box is changed. This happens on blur and if 'Enter' is pressed.TextBoxChangedEventArgs
OnChangingEventCallback<Event>This event is triggered on each key up event of the TextBox, if the value is changed.dynamic oldValue- The previous value before it was changed., dynamic value- The new value.
Changingevent TextBoxChangingEventHandlerThis event is triggered on each key up event of the TextBox, if the value is changed.TextBoxChangingEventArgs

Enums

AutoComplete

AutoComplete.None
AutoComplete.Auto
AutoComplete.Inline
AutoComplete.Manual

TextBoxDisplayMode

TextBoxDisplayMode.Default
TextBoxDisplayMode.Escaped
DropDownOpenMode.None
DropDownOpenMode.Default
DropDownOpenMode.Auto
DropDownPosition.Auto
DropDownPosition.Top
DropDownPosition.Bottom
DropDownPosition.OverlayTop
DropDownPosition.OverlayCenter
DropDownPosition.OverlayBottom
DropDownPosition.CenterBottom
DropDownPosition.CenterTop

EscKeyMode

EscKeyMode.None
EscKeyMode.PreviousValue
EscKeyMode.ClearValue

EnterKeyBehavior

EnterKeyBehavior.Submit
EnterKeyBehavior.ClearOnSubmit

HorizontalScrollBarVisibility

HorizontalScrollBarVisibility.Auto
HorizontalScrollBarVisibility.Disabled
HorizontalScrollBarVisibility.Hidden
HorizontalScrollBarVisibility.Visible

ListItemMeasureMode

ListItemMeasureMode.Auto
ListItemMeasureMode.Precise

VerticalAlignment

VerticalAlignment.Bottom
VerticalAlignment.Center
VerticalAlignment.Top

VerticalScrollBarVisibility

VerticalScrollBarVisibility.Auto
VerticalScrollBarVisibility.Disabled
VerticalScrollBarVisibility.Hidden
VerticalScrollBarVisibility.Visible