New to Telerik UI for BlazorStart a free 30-day trial

The Telerik TextBox class.

Definition

Namespace:Telerik.Blazor.Components

Assembly:Telerik.Blazor.dll

Syntax:

C#
public class TelerikTextBox : TextBoxBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Inheritance: objectComponentBaseBaseComponentTelerikInputBase<string>TextBoxBaseTelerikTextBox...

Implements: IComponentIDisposableIHandleAfterRenderIHandleEvent

Inherited Members TextBoxBase.OnParametersSetAsync()TextBoxBase.OnAfterRenderAsync(bool)TextBoxBase.Dispose()TextBoxBase.InitJsComponentAsync()TextBoxBase.OnParametersSetInternalAsync()TextBoxBase.OnAfterRenderInternalAsync(bool)TextBoxBase.UpdateValueDebounced(string)TextBoxBase.TitleTextBoxBase.PlaceholderTextBoxBase.DataSmartPasteDescriptionAttributeTextBoxBase.WidthTextBoxBase.NameTextBoxBase.DebounceDelayTextBoxBase.ReadOnlyTextBoxBase.AutoCapitalizeTextBoxBase.SpellCheckTelerikInputBase<string>.SetParametersAsync(ParameterView)TelerikInputBase<string>.OnInitializedAsync()TelerikInputBase<string>.FocusAsync()TelerikInputBase<string>.CascadedEditContextTelerikInputBase<string>.FloatingLabelTelerikInputBase<string>.IdTelerikInputBase<string>.EnabledTelerikInputBase<string>.TabIndexTelerikInputBase<string>.ValueExpressionTelerikInputBase<string>.ValueChangedTelerikInputBase<string>.ValueTelerikInputBase<string>.OnChangeTelerikInputBase<string>.OnBlurTelerikInputBase<string>.AriaLabelTelerikInputBase<string>.AriaLabelledByTelerikInputBase<string>.AriaDescribedByTelerikInputBase<string>.ValidateOnTelerikInputBase<string>.InputModeBaseComponent.ShouldRender()BaseComponent.InitLocalizer()BaseComponent.ThrowIfParameterIsNull(object, string)BaseComponent.HaveOptionsChanged(IDictionary<string, object>, IDictionary<string, object>)BaseComponent.GetClassString(params string[])BaseComponent.InvokeAsync<T>(string, params object[])BaseComponent.InvokeAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidAsync(string, params object[])BaseComponent.InvokeVoidAsyncWithoutAwait(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidComponentMethodAsync(string, params object[])BaseComponent.InvokeComponentVoidMethodAsync(string, object)BaseComponent.InvokeDisposeAsync()BaseComponent.StateHasChanged()BaseComponent.RootComponentBaseComponent.ClassComponentBase.OnInitialized()ComponentBase.OnParametersSet()ComponentBase.OnAfterRender(bool)ComponentBase.InvokeAsync(Action)ComponentBase.InvokeAsync(Func<Task>)ComponentBase.DispatchExceptionAsync(Exception)...

Constructors

C#
public TelerikTextBox()

Methods

C#
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters:__builderRenderTreeBuilder

Overrides: ComponentBase.BuildRenderTree(RenderTreeBuilder)

C#
public void OnInput(ChangeEventArgs args)
Parameters:argsChangeEventArgs

Properties

[Accessibility] Sets the HTML autocomplete attribute to control browser autofill behavior for form fields. Use "username" for login fields, "current-password" for existing passwords, "new-password" for password creation. Use "email", "tel", "name", "address-line1" and other standard values for appropriate browser assistance. Set to "off" to disable autocomplete for sensitive or unique fields. Improves user experience by enabling smart browser suggestions based on previous input. See MDN autocomplete documentation for complete list of values.

C#
[Parameter]
public string AutoComplete { get; set; }

Enables WebMCP tool registration for this TextBox. When true, TextBox operations are exposed as tools discoverable by AI models through the browser. Default value is false.

C#
[Parameter]
public bool EnableWebMcpTools { get; set; }

Controls the visual fill style of the TextBox input field affecting its background and border appearance. "ThemeConstants.TextBox.FillMode.Solid" creates a filled background with high contrast borders for traditional form styling. "ThemeConstants.TextBox.FillMode.Outline" uses transparent background with prominent borders for modern, clean interfaces. "ThemeConstants.TextBox.FillMode.Flat" removes most borders and background for minimal, subtle integration. Choose based on your design language - "solid" for conventional forms, "outline" for contemporary UIs, "flat" for embedded contexts. Default value is "ThemeConstants.TextBox.FillMode.Solid".

C#
[Parameter]
public override string FillMode { get; set; }

Overrides: TextBoxBase.FillMode

Sets the maximum number of characters users can enter in the TextBox input field. Provides both client-side validation and helps users understand input constraints. Use for fields with database column limits, API constraints, or user experience requirements. Example: Set to 255 for typical database varchar fields, 50 for name fields, or 10 for phone numbers. When limit is reached, further typing is prevented and browsers may show character count feedback. Essential for preventing data truncation and providing clear user guidance.

C#
[Parameter]
public int? MaxLength { get; set; }

Enables password input mode to hide typed characters for security and privacy. When enabled, displays dots or asterisks instead of actual characters to prevent shoulder surfing. Automatically sets the HTML input type to "password" for proper browser behavior and accessibility. Essential for login forms, password creation/change fields, and any sensitive data entry. Does not affect the actual "TelerikInputBase{T}.Value" - only the visual representation. Default value is "false".

C#
[Parameter]
public bool Password { get; set; }

Controls the corner rounding style of the TextBox input field for visual consistency with your design system. "ThemeConstants.TextBox.Rounded.Small" provides subtle rounded corners for a modern, soft appearance. "ThemeConstants.TextBox.Rounded.Medium" offers moderate rounding suitable for most business applications. "ThemeConstants.TextBox.Rounded.Large" creates prominent rounded corners for friendly, approachable interfaces. "ThemeConstants.TextBox.Rounded.Full" applies maximum rounding for pill-shaped inputs in contemporary designs. Should match other form elements and overall application design language for visual harmony. Default value is "ThemeConstants.TextBox.Rounded.Medium".

C#
[Parameter]
public override string Rounded { get; set; }

Overrides: TextBoxBase.Rounded

Controls whether a clear button (X icon) appears at the end of the TextBox input field. When enabled, users can click the clear button to instantly remove all text content. Improves user experience for quick content removal without selecting and deleting text manually. Most useful for search fields, filters, or temporary input areas where frequent clearing is expected. Default value is "false".

C#
[Parameter]
public bool ShowClearButton { get; set; }

Controls whether a visual separator line appears between the prefix content and the input field. Creates a clear boundary when using TextBoxPrefixTemplate to prevent visual confusion. Set to "false" when prefix content should blend seamlessly with the input area. Helps maintain clean visual hierarchy especially with icon prefixes or when prefix content varies in size. Default value is "true".

C#
[Parameter]
public bool ShowPrefixSeparator { get; set; }

Controls whether a visual separator line appears between the input field and the suffix content. Creates a clear boundary when using TextBoxSuffixTemplate to prevent visual confusion. Set to "false" when suffix content should blend seamlessly with the input area. Particularly useful when combining multiple suffix elements or when ShowClearButton is also enabled. Default value is "true".

C#
[Parameter]
public bool ShowSuffixSeparator { get; set; }

Controls the physical dimensions of the TextBox input field including height, padding, and font size. "ThemeConstants.TextBox.Size.Small" creates compact inputs suitable for dense layouts, data grids, or mobile interfaces. "ThemeConstants.TextBox.Size.Medium" provides standard sizing appropriate for most business forms and general use cases. "ThemeConstants.TextBox.Size.Large" offers prominent inputs ideal for primary actions, accessibility needs, or touch interfaces. Should be consistent across form elements and consider user accessibility requirements - larger sizes improve touch targets. Default value is "ThemeConstants.TextBox.Size.Medium".

C#
[Parameter]
public override string Size { get; set; }

Overrides: TextBoxBase.Size

Sets custom content to display before the input field as a visual prefix element. Use for icons, symbols, or short text that provides context about the expected input. Examples: currency symbols ("$"), search icons, user icons for login fields, or labels like "https://". Combines with ShowPrefixSeparator to control visual separation from the input area. Enhances usability by providing visual cues about input purpose or format expectations. Children: Use any HTML content or Blazor components as prefix content.

C#
[Parameter]
public RenderFragment TextBoxPrefixTemplate { get; set; }

Provides configuration for WebMCP tools, such as a Name to distinguish this TextBox from others on the same page.

C#
[Parameter]
public RenderFragment TextBoxSettings { get; set; }

Sets custom content to display after the input field as a visual suffix element. Use for units of measurement, action buttons, or status indicators that relate to the input value. Examples: measurement units ("px", "kg", "%"), action icons (copy, paste), or validation status icons. Combines with ShowSuffixSeparator to control visual separation from the input area. Different from ShowClearButton which provides a specific clear functionality. Children: Use any HTML content or Blazor components as suffix content.

C#
[Parameter]
public RenderFragment TextBoxSuffixTemplate { get; set; }