Tabs that are links to pages of their own, for sections split across routes (/settings/profile, /settings/billing): a nav of real links drawn as tabs, with no panels and no script needed. The server marks the tab for the current URL.
Tabs that are links
Each TabLink is a link to its page, here to this page with ?view=. The server marks the tab for the current URL as current.
Variant, Size and FullWidth work as on Tabs.
A tab stays current on the pages below its link, so a settings tab is current on settings/billing too. To stop that, set Match="NavLinkMatch.All".
A Disabled tab isn't a link. To say why, set DisabledReason, which shows as its tooltip.
Counts that fit a phone
Badge puts a count after a tab's label, and BadgeStatus colors one that needs attention. A row of five tabs with counts is too wide for a phone, so set BadgeVisibleFrom="Breakpoint.Sm" on the counts that matter less: they show from Sm up.
Parts
Written inside TabNav. The API page lists their parameters.
TabLink: a tab in aTabNav: a link to its own page, marked current from the URL on the server.
Mode support
| Feature | Static | Interactive |
|---|---|---|
| The current page's tab marked on the server | Yes | Yes |
| Links told apart by the query, one current at a time | Yes | Yes |
| A tab marked current from C# (TabLink Current) | Yes | Yes |
Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.
Without JavaScript
Every page starts as plain HTML: before IzzyBlazor's script loads on a static page, while an interactive page prerenders, and with JavaScript off. With JavaScript off, links that don't fit scroll by touch, trackpad or Shift+wheel only, and the current one isn't scrolled into view.
Accessibility
- It's a
navof plain links that Tab moves between (no arrow keys, as these aren't ARIA tabs). - The current page's link has
aria-current; a disabled one is a link with nohref, announced as disabled (aria-disabled), and itsDisabledReasonis its tooltip and description. Labelnames thenav. Give each its own when a page has more than one, or when the purpose isn't clear from the heading before it.
Parameters
| Prop | Type | Default |
|---|---|---|
LabelThe tab strip's name for screen readers, such as "Account settings". | string? | |
VariantHow the tabs look. | TabsVariant | TabsVariant.Line |
SizeTab height and text size, shared with buttons and fields. | ControlSize | ControlSize.Md |
FullWidthStretches the tabs to share the full width (or, vertical, the list's width). | bool | false |
IdThe element id. | string? | |
ChildContentThe tabs. | RenderFragment? |
Plus 17 item props and 4 common props.
Full APISee also
- Tabs: switches between panels, even with JavaScript off.
- NavMenu: lists links and marks the current page.
- SegmentedControl: lets the user pick one of a few choices from joined buttons.
- Blocks that use it: Pricing.