Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenTextBox

    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.

    Inheritance
    object
    ComponentBase
    RadzenComponent
    FormComponent<string>
    FormComponentWithAutoComplete<string>
    RadzenTextBox
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    IRadzenFormComponent
    Inherited Members
    FormComponentWithAutoComplete<string>.SetParametersAsync(ParameterView)
    FormComponentWithAutoComplete<string>.AutoCompleteType
    FormComponentWithAutoComplete<string>.AutoCompleteAttribute
    FormComponentWithAutoComplete<string>.DefaultAutoCompleteAttribute
    FormComponentWithAutoComplete<string>.DefaultAriaAutoCompleteAttribute
    FormComponentWithAutoComplete<string>.AriaAutoCompleteAttribute
    FormComponent<string>._value
    FormComponent<string>.Dispose()
    FormComponent<string>.GetValue()
    FormComponent<string>.OnContextMenu(MouseEventArgs)
    FormComponent<string>.GetClassList(string)
    FormComponent<string>.FocusAsync()
    FormComponent<string>.Name
    FormComponent<string>.TabIndex
    FormComponent<string>.Placeholder
    FormComponent<string>.Disabled
    FormComponent<string>.EditContext
    FormComponent<string>.Form
    FormComponent<string>.ValueChanged
    FormComponent<string>.HasValue
    FormComponent<string>.IsBound
    FormComponent<string>.Value
    FormComponent<string>.Change
    FormComponent<string>.FieldIdentifier
    FormComponent<string>.ValueExpression
    FormComponent<string>.FormFieldContext
    FormComponent<string>.CurrentPlaceholder
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.GetCssClass()
    RadzenComponent.Debounce(Func<Task>, int)
    RadzenComponent.OnInitialized()
    RadzenComponent.OnAfterRenderAsync(bool)
    RadzenComponent.RaiseContextMenu(MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.AddContextMenu()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.Reference
    RadzenComponent.CurrentStyle
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenTextBox : FormComponentWithAutoComplete<string>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
    Examples

    Basic 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" />

    Constructors

    RadzenTextBox()

    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.

    Declaration
    public RadzenTextBox()
    Examples

    Basic 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" />

    Properties

    Immediate

    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.

    Declaration
    [Parameter]
    public bool Immediate { get; set; }
    Property Value
    Type Description
    bool

    true for immediate updates; false for deferred updates. Default is false.

    MaxLength

    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.

    Declaration
    [Parameter]
    public long? MaxLength { get; set; }
    Property Value
    Type Description
    long?

    The maximum character length, or null for no limit. Default is null.

    ReadOnly

    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.

    Declaration
    [Parameter]
    public bool ReadOnly { get; set; }
    Property Value
    Type Description
    bool

    true if the text box is read-only; otherwise, false. Default is false.

    Trim

    Gets or sets whether to automatically remove leading and trailing whitespace from the value. When enabled, whitespace is trimmed when the value changes.

    Declaration
    [Parameter]
    public bool Trim { get; set; }
    Property Value
    Type Description
    bool

    true to trim whitespace; otherwise, false. Default is false.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    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.

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    string
    Overrides
    RadzenComponent.GetComponentCssClass()

    GetId()

    Gets the unique identifier.

    Declaration
    protected override string GetId()
    Returns
    Type Description
    string

    Returns the id attribute (if specified) or generates a random one.

    Overrides
    RadzenComponent.GetId()

    OnChange(ChangeEventArgs)

    Handles the change event of the underlying HTML input element. Applies trimming if enabled and notifies the edit context and change listeners.

    Declaration
    protected Task OnChange(ChangeEventArgs args)
    Parameters
    Type Name Description
    ChangeEventArgs args

    The change event arguments containing the new value.

    Returns
    Type Description
    Task

    A task representing the asynchronous operation.

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    IRadzenFormComponent

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT