RadzenTabs Class

A tabbed interface component that organizes content into multiple panels with clickable tabs for navigation. RadzenTabs allows users to switch between different views or sections without navigating away from the page. Provides a container for RadzenTabsItem components, each representing one tab and its associated content panel. Supports tab positioning at Top, Bottom, Left, Right, TopRight, or BottomRight, server-side rendering (default) or client-side rendering for improved interactivity, programmatic selection via SelectedIndex with two-way binding, Change event when tabs are switched, dynamic tab addition/removal using AddTab() and RemoveItem(), keyboard navigation (Arrow keys, Home, End, Space, Enter) for accessibility, and disabled tabs to prevent selection. Use Server render mode for standard Blazor rendering, or Client mode for faster tab switching with JavaScript.

Inheritance

Object

ComponentBase

RadzenComponent

RadzenTabs

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenTabs : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

Examples

Basic tabs with server-side rendering:

<RadzenTabs>
    <Tabs>
        <RadzenTabsItem Text="Orders">
            Order list and details...
        </RadzenTabsItem>
        <RadzenTabsItem Text="Customers">
            Customer information...
        </RadzenTabsItem>
    </Tabs>
</RadzenTabs>

Tabs with client-side rendering and change event:

<RadzenTabs RenderMode="TabRenderMode.Client" @bind-SelectedIndex=@selectedTab Change=@OnTabChange>
    <Tabs>
        <RadzenTabsItem Text="Tab 1" Icon="home">Content 1</RadzenTabsItem>
        <RadzenTabsItem Text="Tab 2" Icon="settings" Disabled="true">Content 2</RadzenTabsItem>
    </Tabs>
</RadzenTabs>
@code {
    int selectedTab = 0;
    void OnTabChange(int index) => Console.WriteLine($"Selected tab: {index}");
}

Constructors

RadzenTabslink

A tabbed interface component that organizes content into multiple panels with clickable tabs for navigation. RadzenTabs allows users to switch between different views or sections without navigating away from the page. Provides a container for RadzenTabsItem components, each representing one tab and its associated content panel. Supports tab positioning at Top, Bottom, Left, Right, TopRight, or BottomRight, server-side rendering (default) or client-side rendering for improved interactivity, programmatic selection via SelectedIndex with two-way binding, Change event when tabs are switched, dynamic tab addition/removal using AddTab() and RemoveItem(), keyboard navigation (Arrow keys, Home, End, Space, Enter) for accessibility, and disabled tabs to prevent selection. Use Server render mode for standard Blazor rendering, or Client mode for faster tab switching with JavaScript.

Declaration
public RadzenTabs()

Properties

AllowReorderlink

Gets or sets a value indicating whether the user can reorder tabs by dragging and dropping. When enabled, tab headers become draggable and can be rearranged by the user.

Declaration
public bool AllowReorder { get; set; }
Property Value
Type Description
boolGets or sets a value indicating whether the user can reorder tabs by dragging and dropping. When enabled, tab headers become draggable and can be rearranged by the user.

Changelink

Gets or sets the callback invoked when the user switches to a different tab. Provides the index of the newly selected tab. Use this for side effects or logging.

Declaration
public EventCallback<int> Change { get; set; }
Property Value
Type Description
EventCallback<int>Gets or sets the callback invoked when the user switches to a different tab. Provides the index of the newly selected tab. Use this for side effects or logging.

RenderModelink

Gets or sets the rendering mode that determines how tab content is rendered and switched. Server mode re-renders on the server when tabs change, while Client mode uses JavaScript for instant switching.

Declaration
public TabRenderMode RenderMode { get; set; }
Property Value
Type Description
TabRenderModeGets or sets the rendering mode that determines how tab content is rendered and switched. Server mode re-renders on the server when tabs change, while Client mode uses JavaScript for instant switching.

Reorderlink

Gets or sets the callback invoked when tabs are reordered via drag and drop. Provides a TabsReorderEventArgs with the old and new index of the moved tab.

Declaration
public EventCallback<TabsReorderEventArgs> Reorder { get; set; }
Property Value
Type Description
EventCallback<TabsReorderEventArgs>Gets or sets the callback invoked when tabs are reordered via drag and drop. Provides a TabsReorderEventArgs with the old and new index of the moved tab.

SelectedIndexlink

Gets or sets the zero-based index of the currently selected tab. Use with @bind-SelectedIndex for two-way binding to track and control the active tab. Set to -1 for no selection (though typically the first tab is selected automatically).

Declaration
public int SelectedIndex { get; set; }
Property Value
Type Description
intGets or sets the zero-based index of the currently selected tab. Use with @bind-SelectedIndex for two-way binding to track and control the active tab. Set to -1 for no selection (though typically the first tab is selected automatically).

SelectedIndexChangedlink

Gets or sets the callback invoked when the selected tab index changes. Used for two-way binding with @bind-SelectedIndex.

Declaration
public EventCallback<int> SelectedIndexChanged { get; set; }
Property Value
Type Description
EventCallback<int>Gets or sets the callback invoked when the selected tab index changes. Used for two-way binding with @bind-SelectedIndex.

SelectedTablink

Gets the currently selected RadzenTabsItem based on the selectedIndex.

Declaration
public RadzenTabsItem SelectedTab { get; }
Property Value
Type Description
RadzenTabsItemGets the currently selected RadzenTabsItem based on the selectedIndex.

TabPositionlink

Gets or sets the visual position of the tab headers relative to the content panels. Controls the layout direction and can position tabs at Top, Bottom, Left, Right, TopRight, or BottomRight of the content.

Declaration
public TabPosition TabPosition { get; set; }
Property Value
Type Description
TabPositionGets or sets the visual position of the tab headers relative to the content panels. Controls the layout direction and can position tabs at Top, Bottom, Left, Right, TopRight, or BottomRight of the content.

Tabslink

Gets or sets the render fragment containing RadzenTabsItem components that define the tabs. Each RadzenTabsItem represents one tab with its header and content.

Declaration
public RenderFragment Tabs { get; set; }
Property Value
Type Description
RenderFragmentGets or sets the render fragment containing RadzenTabsItem components that define the tabs. Each RadzenTabsItem represents one tab with its header and content.

Methods

AddTablink

Adds the tab.

Declaration
public Task AddTab(RadzenTabsItem tab)
Parameters
Type Name Description
RadzenTabsItem tab The tab.
Returns
Type Description
Task

BuildRenderTreelink

Declaration
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
Parameters
Type Name Description
Rendering.RenderTreeBuilder __builder

GetComponentCssClasslink

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

OnAfterRenderAsynclink

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

OnInitializedlink

Declaration
protected override void OnInitialized()

Reloadlink

Reloads this instance.

Declaration
public void Reload()

RemoveItemlink

Removes the item.

Declaration
public void RemoveItem(RadzenTabsItem item)
Parameters
Type Name Description
RadzenTabsItem item The item.

SetParametersAsynclink

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

ShouldRenderlink

Should render.

Declaration
protected override bool ShouldRender()
Returns
Type Description
bool
An error has occurred. This app may no longer respond until reloaded. Reload 🗙