Tabs & accordion

TabControl · TabStripControl · AccordionControl

Show one section at a time with tabs, document tabs or an accordion.

Overview

TabControl is a Blazor tab control: users switch between sections of a page, and only the selected pane renders. Use TabStripControl for document tabs users close, with the content kept elsewhere, and AccordionControl for stacked sections that expand in place, as on a narrow settings page. Both tab controls come in five themes and let users change orientation from a right-click menu.

Examples

#Tab control

Switch between the Summary, Lines and Notes of a leave request; only the selected pane renders. Review the lines sets the bound SelectedIndex from the page, and the Notes pane holds a button of its own. Pick a theme and a layout with the buttons (One row and Wrapping rows differ only when the tabs overflow), or right-click the tabs: every tab control carries that menu, and @bind-Theme and @bind-Orientation keep the page in step.

Request
LR-0112 December leave
Employee
Albus Door, Tour Operations
Status
Awaiting approval, 3 lines
Total
8 days

Tab 1 of 3 selected · 2 notes · FolderTabs, Horizontal

#Document tabs

Open leave requests with the buttons above the tabs: each opens as a closable tab, and one that is already open is selected instead of opened twice. Close a tab with its ×, reopen the last one, and right-click the strip to change its theme or orientation; when the tabs no longer fit, EnableOverflowNavigation adds Previous and Next buttons. Payroll is a Disabled tab.

Open a request:
Today: new leave requests, requests awaiting approval and absences this week.
1 request open, 0 closed · FolderTabs, Horizontal

#Accordion

Work down the onboarding checklist: checking a step changes the badge in its header, written with HeaderContent, and Sign-off stays Disabled until the three steps are done. Without Multiple, opening one section closes the rest; the switch rebuilds the accordion with it on, so Contract opens again. Unchecking a step while Sign-off is open closes it, because @key rebuilds that item.

1 of 3 steps done

Documentation

ParameterTypeDefaultDescription
SelectedIndexint0Index of the visible pane. Two-way with @bind-SelectedIndex.
SelectedIndexChangedEventCallback<int>—Fires when a different header is selected, by a click or by the arrow keys, Home or End.
ChildContentRenderFragment?—TabItems, optionally inside a TabItems wrapper. Order follows declaration for items present on the first render. An item rendered later is added at the end, and one removed from the markup keeps its header and pane.
CssClassstring?nullAppended to the fx-tabs root. There is no Style; this control does not derive from FlexControlBase.
OrientationTabOrientationTabOrientation.HybridVerticalLayout of the header strip, passed to its TabStripControl: HybridVertical wraps the headers onto rows, Horizontal keeps one scrolling row, Vertical puts a rail beside the pane, 220 px wide or 35% of the control if that is less. Two-way with @bind-Orientation. The strip's right-click menu and overflow buttons are always on here; the control has no switch for them.
OrientationChangedEventCallback<TabOrientation>—After the right-click menu picks an orientation.
ThemeTabThemeTabTheme.WindowsClassicColors of the header strip: WindowsClassic, FolderTabs, ColorfulCards, Minimal or Dark; see the strip's Theme. Two-way with @bind-Theme.
ThemeChangedEventCallback<TabTheme>—After the right-click menu picks a theme.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.