Class MudTextField<T>
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
An input for collecting text values.
public class MudTextField<T> : MudDebouncedInput<T>, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IFormComponent, IAsyncDisposable
Type Parameters
T
The type of object managed by this input.
- Inheritance
-
MudBaseInput<T>MudTextField<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
MudTextField()
public MudTextField()
Properties
AutoGrow
Stretches this input vertically to accommodate the Text value.
[Parameter]
[Category("Behavior")]
public bool AutoGrow { get; set; }
Property Value
Remarks
Defaults to false
.
Classname
protected string Classname { get; }
Property Value
ClearIcon
The icon to display when Clearable is true
.
[Parameter]
[Category("Appearance")]
public string ClearIcon { get; set; }
Property Value
Remarks
Defaults to Clear.
Clearable
Shows a button to clear this input's value.
[Parameter]
[Category("Behavior")]
public bool Clearable { get; set; }
Property Value
Remarks
Defaults to false
.
InputReference
The reference to the underlying MudInput<T> component.
public MudInput<string>? InputReference { get; }
Property Value
InputType
The type of input collected by this component.
[Parameter]
[Category("Behavior")]
public InputType InputType { get; set; }
Property Value
Remarks
Defaults to Text. Represents a valid HTML5 input type.
Mask
The mask to apply to text values.
[Parameter]
[Category("Data")]
public IMask? Mask { get; set; }
Property Value
Remarks
Typically set to common masks such as PatternMask, MultiMask, RegexMask, and BlockMask. When set, some properties will be ignored such as MaxLines, AutoGrow, and HideSpinButtons.
MaxLines
The maximum vertical lines to display when AutoGrow is true
.
[Parameter]
[Category("Behavior")]
public int MaxLines { get; set; }
Property Value
Remarks
Defaults to 0
. When 0
. this property is ignored.
OnClearButtonClick
Occurs when the clear button is clicked.
[Parameter]
public EventCallback<MouseEventArgs> OnClearButtonClick { get; set; }
Property Value
Remarks
Methods
BlurAsync()
When overridden, releases focus from this input.
public override ValueTask BlurAsync()
Returns
BuildRenderTree(RenderTreeBuilder)
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
RenderTreeBuilder
Clear()
public Task Clear()
Returns
FocusAsync()
When overridden, obtains focus for this input.
public override ValueTask FocusAsync()
Returns
ResetValueAsync()
protected override Task ResetValueAsync()
Returns
SelectAsync()
When overridden, selects this input.
public override ValueTask SelectAsync()
Returns
SelectRangeAsync(int, int)
When overridden, selects a portion of the input.
public override ValueTask SelectRangeAsync(int pos1, int pos2)
Parameters
pos1
intThe index of the first character to select.
pos2
intThe index of the last character to select.
Returns
SetText(string)
Sets the Text to the specified value.
public Task SetText(string text)
Parameters
text
stringThe new text value to use.
Returns
SetTextAsync(string?, bool)
protected override Task SetTextAsync(string? text, bool updateValue = true)
Parameters
Returns
SetValueAsync(T?, bool, bool)
protected override Task SetValueAsync(T? value, bool updateText = true, bool force = false)