Base class for all Radzen Blazor components providing common functionality for styling, attributes, events, and lifecycle management. All Radzen components inherit from RadzenComponent to gain standard features like visibility control, custom attributes, mouse events, and disposal. Provides foundational functionality including visibility control via Visible property, custom CSS via Style property and class via Attributes, HTML attribute passing via unmatched parameters, MouseEnter/MouseLeave/ContextMenu event callbacks, localization support for numbers/dates/text, access to the rendered HTML element via Element Reference, and proper cleanup via IDisposable pattern. Components inheriting from RadzenComponent can override GetComponentCssClass() to provide their base CSS classes and use the protected Visible property to control rendering.
Object
ComponentBase
RadzenCheckBoxListItem<TValue>
IComponent
IHandleEvent
IHandleAfterRender
ComponentBase.BuildRenderTree
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen
Assembly: Radzen.Blazor.dll
public class RadzenComponent : ComponentBase, IComponent, IHandleEvent, IHandleAfterRenderBase class for all Radzen Blazor components providing common functionality for styling, attributes, events, and lifecycle management. All Radzen components inherit from RadzenComponent to gain standard features like visibility control, custom attributes, mouse events, and disposal. Provides foundational functionality including visibility control via Visible property, custom CSS via Style property and class via Attributes, HTML attribute passing via unmatched parameters, MouseEnter/MouseLeave/ContextMenu event callbacks, localization support for numbers/dates/text, access to the rendered HTML element via Element Reference, and proper cleanup via IDisposable pattern. Components inheriting from RadzenComponent can override GetComponentCssClass() to provide their base CSS classes and use the protected Visible property to control rendering.
public RadzenComponent()Gets or sets a dictionary of additional HTML attributes that will be applied to the component's root element. Any attributes not explicitly defined as parameters will be captured here and rendered on the element. Use this to add data-* attributes, ARIA attributes, or any custom HTML attributes.
public IReadOnlyDictionary<string, object> Attributes { get; set; }
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | Gets or sets a dictionary of additional HTML attributes that will be applied to the component's root element. Any attributes not explicitly defined as parameters will be captured here and rendered on the element. Use this to add data-* attributes, ARIA attributes, or any custom HTML attributes. |
Gets or sets the callback invoked when the user right-clicks the component. Commonly used with ContextMenuService to display context menus. Receives mouse event arguments containing click position.
public EventCallback<MouseEventArgs> ContextMenu { get; set; }
| Type | Description |
|---|---|
| EventCallback<MouseEventArgs> | Gets or sets the callback invoked when the user right-clicks the component. Commonly used with ContextMenuService to display context menus. Receives mouse event arguments containing click position. |
Gets or sets the culture used for formatting and parsing localizable data (numbers, dates, currency). If not set, uses the DefaultCulture from a parent component or falls back to CurrentCulture.
public Globalization.CultureInfo Culture { get; set; }
| Type | Description |
|---|---|
| Globalization.CultureInfo | Gets or sets the culture used for formatting and parsing localizable data (numbers, dates, currency). If not set, uses the DefaultCulture from a parent component or falls back to CurrentCulture. |
Gets the current style as a dictionary.
protected IDictionary<string, string> CurrentStyle { get; }
| Type | Description |
|---|---|
| IDictionary<string, string> | Gets the current style as a dictionary. |
Gets or sets the default culture cascaded from a parent component. This allows setting a culture at the layout level that applies to all child Radzen components. Child components can override this by setting their own Culture property.
public Globalization.CultureInfo DefaultCulture { get; set; }
| Type | Description |
|---|---|
| Globalization.CultureInfo | Gets or sets the default culture cascaded from a parent component. This allows setting a culture at the layout level that applies to all child Radzen components. Child components can override this by setting their own Culture property. |
Gets a reference to the HTML element rendered by this component. Can be used with JavaScript interop or for programmatic DOM manipulation. The reference is only valid after the component has been rendered (after OnAfterRender).
public ElementReference Element { get; set; }
| Type | Description |
|---|---|
| ElementReference | Gets a reference to the HTML element rendered by this component. Can be used with JavaScript interop or for programmatic DOM manipulation. The reference is only valid after the component has been rendered (after OnAfterRender). |
Gets or sets a value indicating whether JSRuntime is available.
protected bool IsJSRuntimeAvailable { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets a value indicating whether JSRuntime is available. |
Gets or sets the js runtime.
protected Microsoft.JSInterop.IJSRuntime JSRuntime { get; set; }
| Type | Description |
|---|---|
| Microsoft.JSInterop.IJSRuntime | Gets or sets the js runtime. |
Gets or sets the callback invoked when the mouse pointer enters the component's bounds. Commonly used with TooltipService to display tooltips on hover. Receives the component's ElementReference as a parameter.
public EventCallback<ElementReference> MouseEnter { get; set; }
| Type | Description |
|---|---|
| EventCallback<ElementReference> | Gets or sets the callback invoked when the mouse pointer enters the component's bounds. Commonly used with TooltipService to display tooltips on hover. Receives the component's ElementReference as a parameter. |
Gets or sets the callback invoked when the mouse pointer leaves the component's bounds. Commonly used with TooltipService to hide tooltips when hover ends. Receives the component's ElementReference as a parameter.
public EventCallback<ElementReference> MouseLeave { get; set; }
| Type | Description |
|---|---|
| EventCallback<ElementReference> | Gets or sets the callback invoked when the mouse pointer leaves the component's bounds. Commonly used with TooltipService to hide tooltips when hover ends. Receives the component's ElementReference as a parameter. |
Gets the reference for the current component.
protected Microsoft.JSInterop.DotNetObjectReference<RadzenComponent> Reference { get; }
| Type | Description |
|---|---|
| Microsoft.JSInterop.DotNetObjectReference<RadzenComponent> | Gets the reference for the current component. |
Gets or sets the inline CSS style.
public string Style { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the inline CSS style. |
Gets or sets the unique identifier.
public string UniqueID { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the unique identifier. |
Gets or sets a value indicating whether this RadzenComponent is visible. Invisible components are not rendered.
public bool Visible { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets a value indicating whether this RadzenComponent is visible. Invisible components are not rendered. |
Adds context menu for this component.
protected virtual Task AddContextMenu()
| Type | Description |
|---|---|
| Task |
Debounces the specified action.
protected void Debounce(Func<Task> action, int milliseconds)
| Type | Name | Description |
|---|---|---|
| Func<Task> | action | The action. |
| int | milliseconds | The milliseconds. |
Detaches event handlers and disposes Reference.
public virtual void Dispose()Gets the component CSS class.
protected virtual string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
Gets the final CSS class rendered by the component. Combines it with a class custom attribute.
protected string GetCssClass()
| Type | Description |
|---|---|
| string |
Gets the unique identifier.
protected virtual string GetId()
| Type | Description |
|---|---|
| string | Returns the id attribute (if specified) or generates a random one. |
Called by the Blazor runtime.
protected override Task OnAfterRenderAsync(bool firstRender)
| Type | Name | Description |
|---|---|---|
| bool | firstRender |
| Type | Description |
|---|---|
| Task |
Called when the component becomes invisible. Cleans up JS interop resources without full disposal so the component can become visible again.
protected virtual void OnBecameInvisible()Raises ContextMenu.
public virtual Task OnContextMenu(MouseEventArgs args)
| Type | Name | Description |
|---|---|---|
| MouseEventArgs | args | The MouseEventArgs instance containing the event data. |
| Type | Description |
|---|---|
| Task |
Raises MouseEnter.
public Task OnMouseEnter()
| Type | Description |
|---|---|
| Task |
Raises MouseLeave.
public Task OnMouseLeave()
| Type | Description |
|---|---|
| Task |
Invoked via interop when the browser "oncontextmenu" event is raised for this component.
public Task RaiseContextMenu(MouseEventArgs e)
| Type | Name | Description |
|---|---|---|
| MouseEventArgs | e | The MouseEventArgs instance containing the event data. |
| Type | Description |
|---|---|
| Task |
Invoked via interop when the browser "onmouseenter" event is raised for this component.
public Task RaiseMouseEnter()
| Type | Description |
|---|---|
| Task |
Invoked via interop when the browser "onmouseleave" event is raised for this component.
public Task RaiseMouseLeave()
| Type | Description |
|---|---|
| Task |
Called by the Blazor runtime when parameters are set.
public override Task SetParametersAsync(ParameterView parameters)
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters | The parameters. |
| Type | Description |
|---|---|
| Task |