# RadzenComponent Class

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.

Namespace: [Radzen](https://blazor.radzen.com/docs/api/Radzen.md)

Assembly: Radzen.Blazor.dll

## Inheritance

- Object
- ComponentBase
- RadzenComponent

Derived types: [DataBoundFormComponent<T>](https://blazor.radzen.com/docs/api/Radzen.DataBoundFormComponent-1.md), [FormComponent<T>](https://blazor.radzen.com/docs/api/Radzen.FormComponent-1.md), [PagedDataBoundComponent<T>](https://blazor.radzen.com/docs/api/Radzen.PagedDataBoundComponent-1.md), [RadzenComponentWithChildren](https://blazor.radzen.com/docs/api/Radzen.RadzenComponentWithChildren.md), [GaugeBase](https://blazor.radzen.com/docs/api/Radzen.Blazor.GaugeBase.md), [RadzenAccordion](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenAccordion.md), [RadzenAccordionItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenAccordionItem.md), [RadzenAIChat](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenAIChat.md), [RadzenAIPrompt](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenAIPrompt.md), [RadzenAppearanceToggle](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenAppearanceToggle.md), [RadzenBadge](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenBadge.md), [RadzenBarcode](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenBarcode.md), [RadzenBreadCrumbItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenBreadCrumbItem.md), [RadzenButton](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenButton.md), [RadzenCarousel](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenCarousel.md), [RadzenChart](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenChart.md), [RadzenChat](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenChat.md), [RadzenCheckBoxListItem<TValue>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenCheckBoxListItem-1.md), [RadzenChip](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenChip.md), [RadzenChipItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenChipItem.md), [RadzenDataFilter<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenDataFilter-1.md), [RadzenDatePicker<TValue>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenDatePicker-1.md), [RadzenDropZoneItem<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenDropZoneItem-1.md), [RadzenFabMenu](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenFabMenu.md), [RadzenFieldset](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenFieldset.md), [RadzenFormField](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenFormField.md), [RadzenGantt<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenGantt-1.md), [RadzenGoogleMap](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenGoogleMap.md), [RadzenGoogleMapMarker](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenGoogleMapMarker.md), [RadzenGravatar](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenGravatar.md), [RadzenHeading](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenHeading.md), [RadzenHeatmap](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenHeatmap.md), [RadzenIcon](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenIcon.md), [RadzenInlineAIPrompt](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenInlineAIPrompt.md), [RadzenLabel](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenLabel.md), [RadzenLink](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenLink.md), [RadzenLogin](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenLogin.md), [RadzenMarkdown](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenMarkdown.md), [RadzenMenuItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenMenuItem.md), [RadzenPager](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenPager.md), [RadzenPanelMenuItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenPanelMenuItem.md), [RadzenPickList<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenPickList-1.md), [RadzenPopup](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenPopup.md), [RadzenProfileMenuItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenProfileMenuItem.md), [RadzenProgressBar](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenProgressBar.md), [RadzenQRCode](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenQRCode.md), [RadzenRadioButtonListItem<TValue>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenRadioButtonListItem-1.md), [RadzenRangeNavigator](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenRangeNavigator.md), [RadzenSankeyDiagram<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSankeyDiagram-1.md), [RadzenScheduler<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenScheduler-1.md), [RadzenSelectBarItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSelectBarItem.md), [RadzenSidebarToggle](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSidebarToggle.md), [RadzenSkeleton](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSkeleton.md), [RadzenSmartPasteButton<TModel>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSmartPasteButton-1.md), [RadzenSpeechToTextButton](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSpeechToTextButton.md), [RadzenSpiderChart](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSpiderChart.md), [RadzenSpiderColumnSeries<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSpiderColumnSeries-1.md), [RadzenSpiderSeries<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSpiderSeries-1.md), [RadzenSplitButtonItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSplitButtonItem.md), [RadzenSplitter](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSplitter.md), [RadzenSplitterPane](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSplitterPane.md), [RadzenSpreadsheet](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSpreadsheet.md), [RadzenSSRSViewer](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSSRSViewer.md), [RadzenSteps](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenSteps.md), [RadzenStepsItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenStepsItem.md), [RadzenTabs](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTabs.md), [RadzenTemplateForm<TItem>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTemplateForm-1.md), [RadzenText](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenText.md), [RadzenTileLayout](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTileLayout.md), [RadzenTileLayoutItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTileLayoutItem.md), [RadzenTimeline](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTimeline.md), [RadzenTimelineItem](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTimelineItem.md), [RadzenTimeSpanPicker<TValue>](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTimeSpanPicker-1.md), [RadzenToc](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenToc.md), [RadzenTree](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTree.md), [RadzenTreemap](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenTreemap.md), [RadzenUpload](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenUpload.md), [RadzenVirtualKeyboard](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenVirtualKeyboard.md), [ValidatorBase](https://blazor.radzen.com/docs/api/Radzen.Blazor.ValidatorBase.md)

## Implements

- IComponent
- IHandleEvent
- IHandleAfterRender

## Syntax

```csharp
public class RadzenComponent : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender
```

## Constructors

| Constructor | Description |
|-------------|-------------|
| `public RadzenComponent()` | 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. |

## Properties

| Property | Type | Description |
|------|------|-------------|
| Attributes | `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. |
| ContextMenu | `EventCallback<MouseEventArgs>` | Gets or sets the callback invoked when the user right-clicks the component. Commonly used with [ContextMenuService](https://blazor.radzen.com/docs/api/Radzen.ContextMenuService.md) to display context menus. Receives mouse event arguments containing click position. |
| Culture | `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. |
| CurrentStyle | `IDictionary<string, string>` | Gets the current style as a dictionary. |
| DefaultCulture | `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. |
| DefaultUICulture | `Globalization.CultureInfo` | Gets or sets the default UI culture cascaded from a parent component. This allows setting a UI culture at the layout level that applies to all child Radzen components. Child components can override this by setting their own UICulture property. |
| Element | `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). |
| IsJSRuntimeAvailable | `bool` | Gets or sets a value indicating whether JSRuntime is available. |
| JSRuntime | `Microsoft.JSInterop.IJSRuntime` | Gets or sets the js runtime. |
| MouseEnter | `EventCallback<ElementReference>` | Gets or sets the callback invoked when the mouse pointer enters the component's bounds. Commonly used with [TooltipService](https://blazor.radzen.com/docs/api/Radzen.TooltipService.md) to display tooltips on hover. Receives the component's ElementReference as a parameter. |
| MouseLeave | `EventCallback<ElementReference>` | Gets or sets the callback invoked when the mouse pointer leaves the component's bounds. Commonly used with [TooltipService](https://blazor.radzen.com/docs/api/Radzen.TooltipService.md) to hide tooltips when hover ends. Receives the component's ElementReference as a parameter. |
| Reference | `Microsoft.JSInterop.DotNetObjectReference<RadzenComponent>` | Gets the reference for the current component. |
| Style | `string` | Gets or sets the inline CSS style. |
| UICulture | `Globalization.CultureInfo` | Gets or sets the culture used for localized UI strings. If not set, uses the DefaultUICulture from a parent component or falls back to CurrentUICulture. |
| UniqueID | `string` | Gets or sets the unique identifier. |
| Visible | `bool` | Gets or sets a value indicating whether this [RadzenComponent](https://blazor.radzen.com/docs/api/Radzen.RadzenComponent.md) is visible. Invisible components are not rendered. |

## Methods

| Method | Returns | Description |
|------|---------|-------------|
| `AddContextMenu()` | `Task` | Adds context menu for this component. |
| `Debounce(Func<Task> action, int milliseconds)` | `void` | Debounces the specified action. Parameters: `action`: The action. `milliseconds`: The milliseconds. |
| `Dispose()` | `void` | Detaches event handlers and disposes Reference. |
| `GetComponentCssClass()` | `string` | Gets the component CSS class. |
| `GetCssClass()` | `string` | Gets the final CSS class rendered by the component. Combines it with a class custom attribute. |
| `GetId()` | `string` | Gets the unique identifier. Returns: Returns the id attribute (if specified) or generates a random one. |
| `GetIdAttribute()` | `string` | Gets the id attribute specified by the user via unmatched attributes. Returns: The id attribute value or null if it is not specified or empty. |
| `Localize(string key)` | `string` | Returns a localized string for the specified key using the current UICulture. Parameters: `key`: The resource key. Use nameof(RadzenStrings.SomeKey) for compile-time safety. Returns: The localized string. |
| `OnAfterRenderAsync(bool firstRender)` | `Task` | Called by the Blazor runtime. |
| `OnBecameInvisible()` | `void` | Called when the component becomes invisible. Cleans up JS interop resources without full disposal so the component can become visible again. |
| `OnContextMenu(MouseEventArgs args)` | `Task` | Raises ContextMenu. Parameters: `args`: The MouseEventArgs instance containing the event data. |
| `OnInitialized()` | `void` | Called by the Blazor runtime. |
| `OnMouseEnter()` | `Task` | Raises MouseEnter. |
| `OnMouseLeave()` | `Task` | Raises MouseLeave. |
| `RaiseContextMenu(MouseEventArgs e)` | `Task` | Invoked via interop when the browser "oncontextmenu" event is raised for this component. Parameters: `e`: The MouseEventArgs instance containing the event data. |
| `RaiseMouseEnter()` | `Task` | Invoked via interop when the browser "onmouseenter" event is raised for this component. |
| `RaiseMouseLeave()` | `Task` | Invoked via interop when the browser "onmouseleave" event is raised for this component. |
| `SetParametersAsync(ParameterView parameters)` | `Task` | Called by the Blazor runtime when parameters are set. Parameters: `parameters`: The parameters. |

## Inherited Members

- From ComponentBase: Assets, AssignedRenderMode, BuildRenderTree, DispatchExceptionAsync, InvokeAsync, OnAfterRender, OnInitializedAsync, OnParametersSet, OnParametersSetAsync, RendererInfo, ShouldRender, StateHasChanged

