To use TabNav with react-router or
react-router-dom, pass
as={NavLink}
and omit the selected
prop.
This ensures that the NavLink gets activeClassName='selected'
Attention: Make sure to properly label your TabNav
with an aria-label
to provide context about the type of navigation contained in TabNav
.
<TabNav aria-label="Main"><TabNav.Link href="#home" selected>Home</TabNav.Link><TabNav.Link href="#documentation">Documentation</TabNav.Link><TabNav.Link href="#support">Support</TabNav.Link></TabNav>
Name | Type | Default | Description |
---|---|---|---|
aria-label | string | Used to set the `aria-label` on the top level `<nav>` element. | |
sx | SystemStyleObject | Style overrides to apply to the component. See also overriding styles. |
Name | Type | Default | Description |
---|---|---|---|
as | React.ElementType | 'a' | The underlying element to render — either a HTML element name or a React component. |
href | string | ||
selected | boolean | ||
sx | SystemStyleObject | Style overrides to apply to the component. See also overriding styles. |