Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Tab Nav
  3. API and Development

Tab nav

API and Development

View Source
Submit Issue

TabNav builds on Radix Themes TabNav with pathname-based active detection. Pass currentPath, navigate, and matchPath from React Router (or equivalents) so tabs behave as real links—middle-click and “open in new tab” keep working. TabNavItem accepts to or href, optional extraRouteMatchers, counter, leadIcon, and iconTitle.

TabNav

No extracted props

This component does not declare package-specific props in the generated API. It may still accept standard HTML and React attributes for its underlying element (for example className, id, and ARIA attributes). Props whose types come only from dependencies are omitted from this table.

Storybook

Interactive examples and edge cases for this component are in Storybook.

Default
With Active Tab
Many Tabs
Long Tab Names
Without Underline
With Counters
With Extra Route Matchers
Small
With Sliding Animation
Test Use Match Path Fallback
Test Use Tab Nav Change Prevent Redundant
Test Use Tab Nav Change Navigation
Test Use Active Tab Basic
Test Use Active Tab Extra Route Matchers
Test Use Active Tab Href
Test Use Active Tab To Preference
Test Use Active Tab No Match
All Variants

TabNavItem

Name

Type

Default

Description

to / href

string

—

Destination path.

extraRouteMatchers

array

—

Extra paths that mark tab active.

counter

number | string

—

Badge when > 0.

leadIcon

SVGAsset

—

Icon before label.

onClick

MouseEventHandler

—

Runs before default navigation.

Default (interactive)

Second tab active

Many tabs

Long tab names

Without underline

With counters

Extra route matchers

Small

Sliding animation

Static paths (no state)

The preview fixes currentPath and uses a no-op navigate so the active tab is visible without leaving the page.

Picking the right component

ScenarioComponentWhy
Navigate to different routes (URL changes)TabNavRenders <a> links; supports Ctrl/Cmd+click, browser history, pathname matching.
Filter or view-switch without URL changeTabMenuSelection state only—no routing, no content panels.
Switch between content panels on one pageTabsManages visibility of TabsContent panels with ARIA roles.

Previous

Tab Nav / Usage

Next

Tab Nav / Accessibility

On this page

TabNav
Storybook
TabNavItem
Default (interactive)
Second tab active
Many tabs
Long tab names
Without underline
With counters
Extra route matchers
Small
Sliding animation
Static paths (no state)
Picking the right component