Class RadzenTextArea
A multi-line text input component for entering longer text content with configurable dimensions. RadzenTextArea provides a resizable textarea with data binding, validation, and automatic sizing options. Ideal for comments, descriptions, messages, or any content requiring multiple lines. Features configurable sizing via Rows (height) and Cols (width) properties, MaxLength to restrict input length, browser-resizable textarea, integration with Blazor EditContext for form validation, and two-way binding via @bind-Value. The Rows and Cols properties set the initial/minimum size, but users can often resize the textarea using the resize handle.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenTextArea : FormComponent<string>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Examples
Basic textarea:
<RadzenTextArea @bind-Value=@description Rows="5" Placeholder="Enter description..." />
Textarea with character limit:
<RadzenTextArea @bind-Value=@comment Rows="4" Cols="50" MaxLength="500" Placeholder="Enter your comment (max 500 characters)" />
Read-only textarea for display:
<RadzenTextArea Value=@savedContent Rows="10" ReadOnly="true" />
Constructors
RadzenTextArea()
A multi-line text input component for entering longer text content with configurable dimensions. RadzenTextArea provides a resizable textarea with data binding, validation, and automatic sizing options. Ideal for comments, descriptions, messages, or any content requiring multiple lines. Features configurable sizing via Rows (height) and Cols (width) properties, MaxLength to restrict input length, browser-resizable textarea, integration with Blazor EditContext for form validation, and two-way binding via @bind-Value. The Rows and Cols properties set the initial/minimum size, but users can often resize the textarea using the resize handle.
Declaration
public RadzenTextArea()
Examples
Basic textarea:
<RadzenTextArea @bind-Value=@description Rows="5" Placeholder="Enter description..." />
Textarea with character limit:
<RadzenTextArea @bind-Value=@comment Rows="4" Cols="50" MaxLength="500" Placeholder="Enter your comment (max 500 characters)" />
Read-only textarea for display:
<RadzenTextArea Value=@savedContent Rows="10" ReadOnly="true" />
Properties
Cols
Gets or sets the number of visible text columns (width) in the textarea. This determines the initial width of the textarea based on average character width. In modern CSS layouts, setting an explicit width via Style property is often preferred.
Declaration
[Parameter]
public int Cols { get; set; }
Property Value
| Type | Description |
|---|---|
| int | The number of columns. Default is 20. |
MaxLength
Gets or sets the maximum number of characters that can be entered in the textarea. When set, the browser prevents users from entering more characters than 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 textarea is read-only and cannot be edited by the user. When true, the textarea 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 |
|
Rows
Gets or sets the number of visible text rows (height) in the textarea. This determines the initial height of the textarea. Users may be able to resize it depending on browser and CSS settings.
Declaration
[Parameter]
public int Rows { get; set; }
Property Value
| Type | Description |
|---|---|
| int | The number of rows. Default is 2. |
Methods
BuildRenderTree(RenderTreeBuilder)
A multi-line text input component for entering longer text content with configurable dimensions. RadzenTextArea provides a resizable textarea with data binding, validation, and automatic sizing options. Ideal for comments, descriptions, messages, or any content requiring multiple lines. Features configurable sizing via Rows (height) and Cols (width) properties, MaxLength to restrict input length, browser-resizable textarea, integration with Blazor EditContext for form validation, and two-way binding via @bind-Value. The Rows and Cols properties set the initial/minimum size, but users can often resize the textarea using the resize handle.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |
Overrides
GetId()
Gets the unique identifier.
Declaration
protected override string GetId()
Returns
| Type | Description |
|---|---|
| string | Returns the |
Overrides
OnChange(ChangeEventArgs)
Handles the Change event.
Declaration
protected Task OnChange(ChangeEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| ChangeEventArgs | args | The ChangeEventArgs instance containing the event data. |
Returns
| Type | Description |
|---|---|
| Task |