Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
    • Anchors
    • Box
    • Col
    • Container
    • ContainerNext
    • FullPageLayout
    • Grid
    • HStack
    • Header
    • Header
    • LayoutGrid
    • Navigation
    • Pagination
    • Row
    • Section
    • Spacer
    • TabList
    • TabList
    • Tabs
    • VStack
  • Overlays
  • Feedback & status
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
  • Layout & containers
  • Navigation

Navigation

The primary sidebar navigation of an app. One item is selected at a time, and clicking a parent opens its first child.

Health
Component health
Source
View on Github
Design
View Figma
Storybook
View in Storybook
Playground
No Example
Accessibility

compliant

Platform
Web
  • Overview
  • Props
  • Figma

Usage​

  • Home

  • Employees

    • Employees

      (10)

    • Work stoppages

  • Settings

  • When using nested navigation, clicking on the parent will trigger the first child
  • There can be only one selected item at a time

Integration with React Router​

To integrate with react-router, iy's possible to rely on:

  • renderAs to have the navigation items rendered as Link components
  • key to compare current loacation with each item to know which one is selected
  • navigationItemStyles is required to re-apply styles. It is related to a Tamagui bug with the asChild prop.
const { pathname } = useLocation();
return (
<Navigation
selected={pathname}
items={[
{
label: "Home",
key: "/",
icon: <Icon visual="home" />,
renderAs: ({ children }) => (
<A asChild sx={navigationItemStyles}>
<Link to="/">{children}</Link>
</A>
),
},
{
label: "Employees",
key: "employees",
icon: <Icon visual="PeopleTwo" />,
subItems: [
{
label: "Salariés",
key: "/employees",
renderAs: ({ children }) => (
<A asChild sx={navigationItemStyles}>
<Link to="/employees">{children}</Link>
</A>
),
},
],
},
]}
/>
);

Playground​

Loading...

Navigation props

NameTypeDefault ValueDescriptionUsage count
items*NavigationRootItem[]
onSelect((key: string) => void)undefined
selected*string
sxPositionPropsundefined

Style API​

Use sx for one-off adjustments. It accepts these style keys:

alignSelfanimationaspectRatiobottomcursordisplayendflexflexBasisflexGrowflexShrinkheightinsetinsetInlineinsetInlineEndinsetInlineStartleftmarginmarginBottommarginHorizontalmarginInlinemarginInlineEndmarginInlineStartmarginLeftmarginRightmarginTopmarginVerticalmatrixmaxHeightmaxWidthminHeightminWidthopacityperspectivepositionrightrotaterotateXrotateYrotateZscalescaleXscaleYskewXskewYstarttoptransformtransformOriginwidthxyzIndex

Each can be overridden per breakpoint with:

$lg$ltLg$ltMd$ltSm$ltVs$ltXl$ltXxl$md$sm$vs$xl$xs$xxl
Edit this page
Previous
LayoutGrid
Next
Pagination
  • Usage
  • Integration with React Router
  • Playground