Class SfTextBox
The TextBox is an input element that allows to get input from the user. It allows the user to edit or display the text value.
Inheritance
System.Object
SfTextBox
Inherited Members
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BlurHandler()
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.OnChange
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.OnInput
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.OnPaste
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.OnBlur
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.OnFocus
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.ValueExpression
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.SpinButton
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.ValueTemplate
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.IsValueTemplate
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.ClickStopPropagation
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.MouseDowSpinnerPrevent
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.PreventIconHandler
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.MousePreventContainer
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfTextBox : SfInputTextBase<string>
Constructors
SfTextBox()
Declaration
Properties
Autocomplete
Specifies whether the browser is allowed to automatically enter or select a value for the TextBox.
By default, autocomplete is enabled for TextBox.
Possible values are:
- OnSpecifies that autocomplete is enabled
- OffSpecifies that autocomplete is disabled.
Declaration
public AutoComplete Autocomplete { get; set; }
Property Value
BaseAutocomplete
Declaration
protected override string BaseAutocomplete { get; set; }
Property Value
Type |
Description |
System.String |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseAutocomplete
BaseFloatLabelType
Declaration
protected override FloatLabelType BaseFloatLabelType { get; set; }
Property Value
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseFloatLabelType
BaseHtmlAttributes
Declaration
protected override Dictionary<string, object> BaseHtmlAttributes { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseHtmlAttributes
BaseInputAttributes
Declaration
protected override Dictionary<string, object> BaseInputAttributes { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseInputAttributes
BaseIsReadOnlyInput
Declaration
protected override bool BaseIsReadOnlyInput { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseIsReadOnlyInput
BasePlaceholder
Declaration
protected override string BasePlaceholder { get; set; }
Property Value
Type |
Description |
System.String |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BasePlaceholder
BaseReadonly
Declaration
protected override bool BaseReadonly { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseReadonly
BaseShowClearButton
Declaration
protected override bool BaseShowClearButton { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseShowClearButton
BaseTabIndex
Declaration
protected override int BaseTabIndex { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseTabIndex
BaseWidth
Declaration
protected override string BaseWidth { get; set; }
Property Value
Type |
Description |
System.String |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.BaseWidth
Blur
Triggers when the TextBox has focus-out.
Declaration
public EventCallback<FocusOutEventArgs> Blur { get; set; }
Property Value
ContainerClass
Declaration
protected override string ContainerClass { get; set; }
Property Value
Type |
Description |
System.String |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.ContainerClass
Created
Triggers when the TextBox component is created.
Declaration
public EventCallback<object> Created { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
|
Destroyed
Triggers when the TextBox component is destroyed.
Declaration
public EventCallback<object> Destroyed { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<System.Object> |
|
FloatLabelType
Specifies the floating label behavior of the TextBox that the placeholder text floats above the TextBox based on the following values.
Possible values are:
- NeverNever floats the label in the TextBox when the placeholder is available.
- AlwaysThe floating label always floats above the TextBox.
- AutoThe floating label floats above the TextBox after focusing it or when enters the value in it.
Declaration
public FloatLabelType FloatLabelType { get; set; }
Property Value
Focus
Triggers when the TextBox gets focus.
Declaration
public EventCallback<FocusInEventArgs> Focus { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<FocusInEventArgs> |
|
HtmlAttributes
You can add the additional html attributes such as styles, class, and more to the root element.
If you configured both property and equivalent html attributes, then the component considers the property value.
Declaration
public Dictionary<string, object> HtmlAttributes { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
|
Input
Triggers each time when the value of TextBox has changed.
Declaration
public EventCallback<InputEventArgs> Input { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<InputEventArgs> |
|
InputAttributes
You can add the additional input attributes such as disabled, value, and more to the root element.
If you configured both property and equivalent input attribute, then the component considers the property value.
Declaration
public Dictionary<string, object> InputAttributes { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.Dictionary<System.String, System.Object> |
|
Multiline
Specifies a boolean value that enables or disables the multiline on the TextBox.
The TextBox changes from a single line to multiline when enabling this multiline mode.
Declaration
public bool Multiline { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
MultilineInput
Declaration
protected override bool MultilineInput { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.MultilineInput
Placeholder
Specifies the boolean value whether the TextBox allows user to change the text.
Declaration
public string Placeholder { get; set; }
Property Value
Type |
Description |
System.String |
|
Readonly
Specifies the boolean value whether the TextBox allows user to change the text.
Declaration
public bool Readonly { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
RootClass
Declaration
protected override string RootClass { get; set; }
Property Value
Type |
Description |
System.String |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.RootClass
ShowClearButton
Specifies a boolean value that indicates whether the clear button is displayed in TextBox.
Declaration
public bool ShowClearButton { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
TabIndex
Specifies the tab order of the TextBox component.
Declaration
public int TabIndex { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Type
Specifies the behavior of the TextBox such as text, password, email, and more.
Declaration
public InputType Type { get; set; }
Property Value
ValueChange
Triggers when the content of TextBox has changed and gets focus-out.
Declaration
public EventCallback<ChangedEventArgs> ValueChange { get; set; }
Property Value
Type |
Description |
Microsoft.AspNetCore.Components.EventCallback<ChangedEventArgs> |
|
Width
Specifies the width of the TextBox component.
Declaration
public string Width { get; set; }
Property Value
Type |
Description |
System.String |
|
Methods
AddIconAsync(String, String, Dictionary<String, Object>)
Adding the icons to the TextBox component.
Declaration
public Task AddIconAsync(string position, string icons, Dictionary<string, object> events = null)
Parameters
Type |
Name |
Description |
System.String |
position |
The adding icons to the component based on position for prepend/append.
|
System.String |
icons |
The icons class is added to icon element.
|
System.Collections.Generic.Dictionary<System.String, System.Object> |
events |
The icon events are added to the events element
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
Task.
|
Examples
The below code demonstrates usage of AddIconAsync method through component instance. While passing Events parameter, ontouchstart denotes the Event type and the touchstart denotes the EventHandler method.
Instance.AddIconAsync("prepend", "e-icon-pan", new Dictionary<string, object>() { { "ontouchstart", touchStart } });
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder |
__builder |
|
ChangeHandler(ChangeEventArgs)
Declaration
protected override Task ChangeHandler(ChangeEventArgs args)
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Components.ChangeEventArgs |
args |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.ChangeHandler(Microsoft.AspNetCore.Components.ChangeEventArgs)
FocusAsync()
Sets the focus to TextBox component for interaction.
Declaration
Returns
Type |
Description |
System.Threading.Tasks.Task |
Task.
|
FocusHandler(FocusEventArgs)
Declaration
protected override Task FocusHandler(FocusEventArgs args)
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Components.Web.FocusEventArgs |
args |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.FocusHandler(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
FocusOutAsync()
Remove the focus from TextBox component, if the component is in focus state.
Declaration
public Task FocusOutAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
Task.
|
FocusOutHandler(FocusEventArgs)
Declaration
protected override Task FocusOutHandler(FocusEventArgs args)
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Components.Web.FocusEventArgs |
args |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.FocusOutHandler(Microsoft.AspNetCore.Components.Web.FocusEventArgs)
FormatValue(String)
Declaration
protected override string FormatValue(string genericValue)
Parameters
Type |
Name |
Description |
System.String |
genericValue |
|
Returns
Type |
Description |
System.String |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.FormatValue(System.String)
GetPersistDataAsync()
Gets the properties to be maintained in the persisted state.
Declaration
public Task<string> GetPersistDataAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.String> |
Task.
|
InputHandler(ChangeEventArgs)
Declaration
protected override Task InputHandler(ChangeEventArgs args)
Parameters
Type |
Name |
Description |
Microsoft.AspNetCore.Components.ChangeEventArgs |
args |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
Syncfusion.Blazor.Inputs.SfInputTextBase<System.String>.InputHandler(Microsoft.AspNetCore.Components.ChangeEventArgs)