Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class 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.

    Inheritance
    object
    ComponentBase
    RadzenComponent
    GaugeBase
    RadzenAIChat
    RadzenAccordion
    RadzenAccordionItem
    RadzenAppearanceToggle
    RadzenBadge
    RadzenBreadCrumbItem
    RadzenButton
    RadzenCarousel
    RadzenChart
    RadzenChat
    RadzenCheckBoxListItem<TValue>
    RadzenDataFilter<TItem>
    RadzenDatePicker<TValue>
    RadzenDropZoneItem<TItem>
    RadzenFabMenu
    RadzenFieldset
    RadzenFormField
    RadzenGoogleMap
    RadzenGoogleMapMarker
    RadzenGravatar
    RadzenHeading
    RadzenIcon
    RadzenLabel
    RadzenLink
    RadzenLogin
    RadzenMarkdown
    RadzenMenuItem
    RadzenPager
    RadzenPanelMenuItem
    RadzenPickList<TItem>
    RadzenProfileMenuItem
    RadzenProgressBar
    RadzenQRCode
    RadzenRadioButtonListItem<TValue>
    RadzenSSRSViewer
    RadzenSankeyDiagram<TItem>
    RadzenScheduler<TItem>
    RadzenSelectBarItem
    RadzenSidebarToggle
    RadzenSkeleton
    RadzenSpeechToTextButton
    RadzenSplitButtonItem
    RadzenSplitter
    RadzenSplitterPane
    RadzenSteps
    RadzenStepsItem
    RadzenTabs
    RadzenTemplateForm<TItem>
    RadzenText
    RadzenTimeSpanPicker<TValue>
    RadzenTimeline
    RadzenTimelineItem
    RadzenToc
    RadzenTree
    RadzenUpload
    ValidatorBase
    DataBoundFormComponent<T>
    FormComponent<T>
    PagedDataBoundComponent<T>
    RadzenComponentWithChildren
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.OnInitializedAsync()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenComponent : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

    Constructors

    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.

    Declaration
    public RadzenComponent()

    Properties

    Attributes

    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.

    Declaration
    [Parameter(CaptureUnmatchedValues = true)]
    public IReadOnlyDictionary<string, object> Attributes { get; set; }
    Property Value
    Type Description
    IReadOnlyDictionary<string, object>

    The unmatched attributes dictionary.

    ContextMenu

    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.

    Declaration
    [Parameter]
    public EventCallback<MouseEventArgs> ContextMenu { get; set; }
    Property Value
    Type Description
    EventCallback<MouseEventArgs>

    The context menu (right-click) event callback.

    Culture

    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.

    Declaration
    [Parameter]
    public CultureInfo Culture { get; set; }
    Property Value
    Type Description
    CultureInfo

    The culture for localization. Default is CurrentCulture.

    CurrentStyle

    Gets the current style as a dictionary.

    Declaration
    protected IDictionary<string, string> CurrentStyle { get; }
    Property Value
    Type Description
    IDictionary<string, string>

    The current style as a dictionary of keys and values.

    DefaultCulture

    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.

    Declaration
    [CascadingParameter(Name = "DefaultCulture")]
    public CultureInfo DefaultCulture { get; set; }
    Property Value
    Type Description
    CultureInfo

    The cascaded default culture.

    Element

    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).

    Declaration
    public ElementReference Element { get; protected set; }
    Property Value
    Type Description
    ElementReference

    The element reference to the rendered HTML element.

    IsJSRuntimeAvailable

    Gets or sets a value indicating whether JSRuntime is available.

    Declaration
    protected bool IsJSRuntimeAvailable { get; set; }
    Property Value
    Type Description
    bool

    JSRuntime

    Gets or sets the js runtime.

    Declaration
    [Inject]
    protected IJSRuntime JSRuntime { get; set; }
    Property Value
    Type Description
    IJSRuntime

    The js runtime.

    MouseEnter

    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.

    Declaration
    [Parameter]
    public EventCallback<ElementReference> MouseEnter { get; set; }
    Property Value
    Type Description
    EventCallback<ElementReference>

    The mouse enter event callback.

    MouseLeave

    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.

    Declaration
    [Parameter]
    public EventCallback<ElementReference> MouseLeave { get; set; }
    Property Value
    Type Description
    EventCallback<ElementReference>

    The mouse leave event callback.

    Reference

    Gets the reference for the current component.

    Declaration
    protected DotNetObjectReference<RadzenComponent> Reference { get; }
    Property Value
    Type Description
    DotNetObjectReference<RadzenComponent>

    The reference.

    Style

    Gets or sets the inline CSS style.

    Declaration
    [Parameter]
    public virtual string Style { get; set; }
    Property Value
    Type Description
    string

    The style.

    UniqueID

    Gets or sets the unique identifier.

    Declaration
    public string UniqueID { get; set; }
    Property Value
    Type Description
    string

    The unique identifier.

    Visible

    Gets or sets a value indicating whether this RadzenComponent is visible. Invisible components are not rendered.

    Declaration
    [Parameter]
    public virtual bool Visible { get; set; }
    Property Value
    Type Description
    bool

    true if visible; otherwise, false.

    Methods

    AddContextMenu()

    Adds context menu for this component.

    Declaration
    protected virtual Task AddContextMenu()
    Returns
    Type Description
    Task

    Debounce(Func<Task>, int)

    Debounces the specified action.

    Declaration
    protected void Debounce(Func<Task> action, int milliseconds = 500)
    Parameters
    Type Name Description
    Func<Task> action

    The action.

    int milliseconds

    The milliseconds.

    Dispose()

    Detaches event handlers and disposes Reference.

    Declaration
    public virtual void Dispose()

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected virtual string GetComponentCssClass()
    Returns
    Type Description
    string

    GetCssClass()

    Gets the final CSS class rendered by the component. Combines it with a class custom attribute.

    Declaration
    protected string GetCssClass()
    Returns
    Type Description
    string

    GetId()

    Gets the unique identifier.

    Declaration
    protected virtual string GetId()
    Returns
    Type Description
    string

    Returns the id attribute (if specified) or generates a random one.

    OnAfterRenderAsync(bool)

    Called by the Blazor runtime.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender
    Returns
    Type Description
    Task
    Overrides
    ComponentBase.OnAfterRenderAsync(bool)

    OnContextMenu(MouseEventArgs)

    Raises ContextMenu.

    Declaration
    public virtual Task OnContextMenu(MouseEventArgs args)
    Parameters
    Type Name Description
    MouseEventArgs args

    The MouseEventArgs instance containing the event data.

    Returns
    Type Description
    Task

    OnInitialized()

    Called by the Blazor runtime.

    Declaration
    protected override void OnInitialized()
    Overrides
    ComponentBase.OnInitialized()

    OnMouseEnter()

    Raises MouseEnter.

    Declaration
    public Task OnMouseEnter()
    Returns
    Type Description
    Task

    OnMouseLeave()

    Raises MouseLeave.

    Declaration
    public Task OnMouseLeave()
    Returns
    Type Description
    Task

    RaiseContextMenu(MouseEventArgs)

    Invoked via interop when the browser "oncontextmenu" event is raised for this component.

    Declaration
    [JSInvokable("RadzenComponent.RaiseContextMenu")]
    public Task RaiseContextMenu(MouseEventArgs e)
    Parameters
    Type Name Description
    MouseEventArgs e

    The MouseEventArgs instance containing the event data.

    Returns
    Type Description
    Task

    RaiseMouseEnter()

    Invoked via interop when the browser "onmouseenter" event is raised for this component.

    Declaration
    [JSInvokable("RadzenComponent.RaiseMouseEnter")]
    public Task RaiseMouseEnter()
    Returns
    Type Description
    Task

    RaiseMouseLeave()

    Invoked via interop when the browser "onmouseleave" event is raised for this component.

    Declaration
    [JSInvokable("RadzenComponent.RaiseMouseLeave")]
    public Task RaiseMouseLeave()
    Returns
    Type Description
    Task

    SetParametersAsync(ParameterView)

    Called by the Blazor runtime when parameters are set.

    Declaration
    public override Task SetParametersAsync(ParameterView parameters)
    Parameters
    Type Name Description
    ParameterView parameters

    The parameters.

    Returns
    Type Description
    Task
    Overrides
    ComponentBase.SetParametersAsync(ParameterView)

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT