FormComponent<T> Class

Base class for all Radzen form input components providing data binding, validation, and change event capabilities. FormComponent integrates with Blazor's EditContext for form validation and provides common functionality for all input controls. This is the base class for components like RadzenTextBox, RadzenCheckBox, RadzenDropDown, RadzenDatePicker, etc. Provides @bind-Value support for two-way binding, integration with Blazor EditContext and validators, Change and ValueChanged callbacks, Disable property to prevent user interaction, Placeholder text for empty inputs, Name property for validation and label association, and TabIndex for keyboard navigation control. Components inheriting from FormComponent automatically work with RadzenTemplateForm and validators.

Inheritance

Object

ComponentBase

RadzenComponent

FormComponent<T>

Implements

IComponent

IHandleEvent

IHandleAfterRender

IRadzenFormComponent

Namespace: Radzen

Assembly: Radzen.Blazor.dll

Syntax

public class FormComponent<T> : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IRadzenFormComponent

Type Parameters

Name Description
TThe type of the component's bound value (string, int, DateTime, etc.).

Constructors

FormComponent<T>link

Base class for all Radzen form input components providing data binding, validation, and change event capabilities. FormComponent integrates with Blazor's EditContext for form validation and provides common functionality for all input controls. This is the base class for components like RadzenTextBox, RadzenCheckBox, RadzenDropDown, RadzenDatePicker, etc. Provides @bind-Value support for two-way binding, integration with Blazor EditContext and validators, Change and ValueChanged callbacks, Disable property to prevent user interaction, Placeholder text for empty inputs, Name property for validation and label association, and TabIndex for keyboard navigation control. Components inheriting from FormComponent automatically work with RadzenTemplateForm and validators.

Declaration
public FormComponent<T>()

Fields

_valuelink

The value

Declaration
protected T _value

Properties

Changelink

Gets or sets the change.

Declaration
public EventCallback<T> Change { get; set; }
Property Value
Type Description
EventCallback<T>Gets or sets the change.

CurrentPlaceholderlink

Gets the current placeholder. Returns empty string if this component is inside a RadzenFormField.

Declaration
protected string CurrentPlaceholder { get; }
Property Value
Type Description
stringGets the current placeholder. Returns empty string if this component is inside a RadzenFormField.

Disabledlink

Gets or sets a value indicating whether this FormComponent<T> is disabled.

Declaration
public bool Disabled { get; set; }
Property Value
Type Description
boolGets or sets a value indicating whether this FormComponent<T> is disabled.

EditContextlink

Gets or sets the edit context.

Declaration
public Forms.EditContext EditContext { get; set; }
Property Value
Type Description
Forms.EditContextGets or sets the edit context.

FieldIdentifierlink

Gets the field identifier.

Declaration
public Forms.FieldIdentifier FieldIdentifier { get; set; }
Property Value
Type Description
Forms.FieldIdentifierGets the field identifier.

Formlink

Gets or sets the form.

Declaration
public IRadzenForm Form { get; set; }
Property Value
Type Description
IRadzenFormGets or sets the form.

FormFieldContextlink

Provides support for RadzenFormField integration.

Declaration
public IFormFieldContext FormFieldContext { get; set; }
Property Value
Type Description
IFormFieldContextProvides support for RadzenFormField integration.

HasValuelink

Gets a value indicating whether this instance has value.

Declaration
public bool HasValue { get; }
Property Value
Type Description
boolGets a value indicating whether this instance has value.

IsBoundlink

Gets a value indicating whether this instance is bound.

Declaration
public bool IsBound { get; }
Property Value
Type Description
boolGets a value indicating whether this instance is bound.

Namelink

Gets or sets the unique name identifier for this form component. Used for validation association (linking with validators and labels) and for identifying the field in form submission. This name should be unique within the form and match the Component property of associated validators/labels.

Declaration
public string Name { get; set; }
Property Value
Type Description
stringGets or sets the unique name identifier for this form component. Used for validation association (linking with validators and labels) and for identifying the field in form submission. This name should be unique within the form and match the Component property of associated validators/labels.

Placeholderlink

Gets or sets the placeholder.

Declaration
public string Placeholder { get; set; }
Property Value
Type Description
stringGets or sets the placeholder.

TabIndexlink

Gets or sets the tab order index for keyboard navigation. Controls the order in which fields receive focus when the user presses the Tab key. Lower values receive focus first. Use -1 to exclude from tab navigation.

Declaration
public int TabIndex { get; set; }
Property Value
Type Description
intGets or sets the tab order index for keyboard navigation. Controls the order in which fields receive focus when the user presses the Tab key. Lower values receive focus first. Use -1 to exclude from tab navigation.

Valuelink

Gets or sets the value.

Declaration
public T Value { get; set; }
Property Value
Type Description
TGets or sets the value.

ValueChangedlink

Gets or sets the value changed.

Declaration
public EventCallback<T> ValueChanged { get; set; }
Property Value
Type Description
EventCallback<T>Gets or sets the value changed.

ValueExpressionlink

Gets or sets the value expression.

Declaration
public Expressions.Expression<Func<T>> ValueExpression { get; set; }
Property Value
Type Description
Expressions.Expression<Func<T>>Gets or sets the value expression.

Methods

Disposelink

Disposes this instance.

Declaration
public override void Dispose()

FocusAsynclink

Declaration
public virtual ValueTask FocusAsync()
Returns
Type Description
ValueTask

GetClassListlink

Gets the class list.

Declaration
protected Rendering.ClassList GetClassList(string className)
Parameters
Type Name Description
string className Name of the class.
Returns
Type Description
Rendering.ClassListClassList.

GetValuelink

Gets the value.

Declaration
public object GetValue()
Returns
Type Description
objectSystem.Object.

OnContextMenulink

Handles the ContextMenu event.

Declaration
public override Task OnContextMenu(MouseEventArgs args)
Parameters
Type Name Description
MouseEventArgs args The MouseEventArgs instance containing the event data.
Returns
Type Description
TaskTask.

SetParametersAsynclink

Sets the parameters asynchronous.

Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
Type Name Description
ParameterView parameters The parameters.
Returns
Type Description
TaskTask.
An error has occurred. This app may no longer respond until reloaded. Reload 🗙