A single-line text input component that supports data binding, validation, and various input behaviors. RadzenTextBox provides a styled text input with support for placeholders, autocomplete, immediate updates, and string trimming. Supports two-way data binding via @bind-Value and form validation when used within Radzen forms. Can be configured for immediate value updates as the user types or deferred updates on blur/change. Use Trim to automatically remove whitespace, and MaxLength to limit input length.
FormComponentWithAutoComplete<string>.SetParametersAsync
FormComponentWithAutoComplete<string>.AutoCompleteType
FormComponentWithAutoComplete<string>.AutoCompleteAttribute
FormComponentWithAutoComplete<string>.DefaultAutoCompleteAttribute
FormComponentWithAutoComplete<string>.DefaultAriaAutoCompleteAttribute
FormComponentWithAutoComplete<string>.AriaAutoCompleteAttribute
FormComponent<string>.GetValue
FormComponent<string>.OnContextMenu
FormComponent<string>.GetClassList
FormComponent<string>.FocusAsync
FormComponent<string>.TabIndex
FormComponent<string>.Placeholder
FormComponent<string>.Disabled
FormComponent<string>.EditContext
FormComponent<string>.ValueChanged
FormComponent<string>.HasValue
FormComponent<string>.FieldIdentifier
FormComponent<string>.ValueExpression
FormComponent<string>.FormFieldContext
FormComponent<string>.CurrentPlaceholder
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenTextBox : FormComponentWithAutoComplete<string>, IComponent, IHandleEvent, IHandleAfterRender, IRadzenFormComponentBasic usage with two-way binding:
<RadzenTextBox @bind-Value=@username Placeholder="Enter username" />
With immediate updates and trimming:
<RadzenTextBox @bind-Value=@value Immediate="true" Trim="true" MaxLength="50" />
Read-only text box:
<RadzenTextBox Value=@displayValue ReadOnly="true" />A single-line text input component that supports data binding, validation, and various input behaviors. RadzenTextBox provides a styled text input with support for placeholders, autocomplete, immediate updates, and string trimming. Supports two-way data binding via @bind-Value and form validation when used within Radzen forms. Can be configured for immediate value updates as the user types or deferred updates on blur/change. Use Trim to automatically remove whitespace, and MaxLength to limit input length.
public RadzenTextBox()Gets or sets whether the component should update the bound value immediately as the user types (oninput event), rather than waiting for the input to lose focus (onchange event). This enables real-time value updates but may trigger more frequent change events.
public bool Immediate { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether the component should update the bound value immediately as the user types (oninput event), rather than waiting for the input to lose focus (onchange event). This enables real-time value updates but may trigger more frequent change events. |
Gets or sets the maximum number of characters that can be entered in the text box. When set, the browser will prevent users from typing beyond this limit.
public long? MaxLength { get; set; }
| Type | Description |
|---|---|
| long? | Gets or sets the maximum number of characters that can be entered in the text box. When set, the browser will prevent users from typing beyond this limit. |
Gets or sets whether the text box is read-only and cannot be edited by the user. When true, the text box displays the value but prevents user input while still allowing selection and copying.
public bool ReadOnly { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether the text box is read-only and cannot be edited by the user. When true, the text box displays the value but prevents user input while still allowing selection and copying. |
Gets or sets whether to automatically remove leading and trailing whitespace from the value. When enabled, whitespace is trimmed when the value changes.
public bool Trim { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether to automatically remove leading and trailing whitespace from the value. When enabled, whitespace is trimmed when the value changes. |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | __builder |
protected override string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
Handles the change event of the underlying HTML input element. Applies trimming if enabled and notifies the edit context and change listeners.
protected virtual Task OnChange(ChangeEventArgs args)
| Type | Name | Description |
|---|---|---|
| ChangeEventArgs | args | The change event arguments containing the new value. |
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
Handles the set binding of the underlying HTML input element. Applies trimming if enabled and notifies the edit context and change listeners.
protected virtual Task SetValue(string value)
| Type | Name | Description |
|---|---|---|
| string | value | string containing the new value. |
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |