A form field container component that wraps input components with labels, icons, helper text, and validation messages. RadzenFormField provides a Material Design-style field layout with floating labels and consistent spacing. Enhances form inputs by adding structure, labels, and supplementary content in a cohesive layout. Features top-aligned or floating labels via Text property, Start/End content for icons or buttons before/after the input (e.g., search icon, clear button), helper text for explanatory text or validation messages below the input, Filled/Outlined/Flat variants matching Material Design, floating labels that animate upward when input is focused or has value, and automatic display of validation messages when used with validators. Compatible with RadzenTextBox, RadzenTextArea, RadzenPassword, RadzenDropDown, RadzenNumeric, RadzenDatePicker, and similar input components. Use Start for leading icons (search, email), End for trailing icons (visibility toggle, clear button).
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponent.SetParametersAsync
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
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 RadzenFormField : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRenderBasic form field with label:
<RadzenFormField Text="Email Address">
<RadzenTextBox @bind-Value=@email />
</RadzenFormField>
Form field with icon and validation:
<RadzenTemplateForm Data=@model>
<RadzenFormField Text="Search" Variant="Variant.Outlined">
<Start><RadzenIcon Icon="search" /></Start>
<ChildContent>
<RadzenTextBox Name="SearchTerm" @bind-Value=@model.SearchTerm />
</ChildContent>
<Helper>
<RadzenRequiredValidator Component="SearchTerm" Text="Search term is required" />
</Helper>
</RadzenFormField>
</RadzenTemplateForm>
Floating label form field:
<RadzenFormField Text="Username" AllowFloatingLabel="true" Variant="Variant.Filled">
<RadzenTextBox />
</RadzenFormField>Initializes a new instance of the RadzenFormField class.
public RadzenFormField()Gets or sets a value indicating whether the label is floating or fixed on top.
public bool AllowFloatingLabel { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets a value indicating whether the label is floating or fixed on top. |
Gets or sets the input component to wrap. Place the input component (RadzenTextBox, RadzenDropDown, etc.) here. The form field automatically integrates with the input for labels and validation.
public RenderFragment ChildContent { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets the input component to wrap. Place the input component (RadzenTextBox, RadzenDropDown, etc.) here. The form field automatically integrates with the input for labels and validation. |
Gets or sets the name of the form field. Used to associate the label with a component.
public string Component { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the name of the form field. Used to associate the label with a component. |
Gets or sets content to render after (trailing position of) the input field. Typically used for icons like visibility toggle, clear button, or suffix text like units. Appears inside the form field border, after the input element.
public RenderFragment End { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets content to render after (trailing position of) the input field. Typically used for icons like visibility toggle, clear button, or suffix text like units. Appears inside the form field border, after the input element. |
Gets or sets content to render below the input field. Used for helper text, hints, character counters, or validation messages. Validators placed here are automatically displayed when validation fails.
public RenderFragment Helper { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets content to render below the input field. Used for helper text, hints, character counters, or validation messages. Validators placed here are automatically displayed when validation fails. |
Gets or sets content to render before (leading position of) the input field. Typically used for icons like search, email, lock, or prefix text like currency symbols. Appears inside the form field border, before the input element.
public RenderFragment Start { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets content to render before (leading position of) the input field. Typically used for icons like search, email, lock, or prefix text like currency symbols. Appears inside the form field border, before the input element. |
Gets or sets the label text.
public string Text { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the label text. |
Gets or sets the custom content for the label using a Razor template. When provided, this template will be rendered instead of the plain text specified in the Text parameter.
public RenderFragment TextTemplate { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets the custom content for the label using a Razor template. When provided, this template will be rendered instead of the plain text specified in the Text parameter. |