Skip to main content

Navigation Menu

The desktop site navigation on Base UI's Navigation Menu: caps bar items whose triggers open dropdown, overview or index panels under the bar. Inside a Navigation Bar it runs from --fgd-nav-inline-n-above (1024 px by default); below it the drawer takes over.

import {
  NavigationMenu,
  NavigationMenuItem,
  NavigationMenuTrigger,
  NavigationMenuContent,
  NavigationMenuLink,
} from '@fairgarden/design/navigation/navigation-menu'

Triggers are buttons. They open on click, Enter, Space or ArrowDown, and on mouse hover intent: 150 ms (--fgd-delay-nav-open) to open and 300 ms (--fgd-delay-nav-close) to close after the pointer leaves, both fed to Base UI from the one NAV_DELAY_MS constant. Once a panel is open, the next trigger switches instantly, and the safe pointer path keeps a diagonal move into a panel from switching it. Focus alone never opens a panel. Opening from the keyboard moves focus to the panel's first link, and Escape closes it and returns focus to the trigger. Only the open trigger reads aria-expanded="true", and closed panels are unmounted.

Pass currentPath, or let the Navigation Bar pass it. A link whose path equals it is current (aria-current="page": the --border-size-2-25 bar and weight 700 in the bar, a weight and underline in a panel). A bar item whose section (for a trigger) or href is a path prefix of it is the parent of current (aria-current="true", a --border-size-2 bar). Hover is an accent underline under the label, and open is the --border-size-2-25 bar flush with the rule, so hover, open and current never look alike.

From the navigation data. NavigationMenuSections builds the items from the shared navigation data (SitemapSections from @fairgarden/design/utils/navigation), the same object that feeds the drawer's sections and the footer's sitemap, so the footer mirrors the panels (see the Footer's navigation demo). A section with a description, a promo or third-tier links opens an overview panel, panel: 'index' an index panel, and a flat section a dropdown that starts with its landing page; a section with only an href is a plain bar link.

Overview panels

Overview panels

kind="overview" is full-bleed under the bar, with its content on the 12-column grid of --fgd-container-content. featured takes the section's landing page, a serif link with a › and a one-line description, then a hairline tier rule. The children are caps link groups, 2-up in columns 1–8 beside the optional promo card (one Tab stop), or up to 4-up without it. search adds one Search field; the panel stays open while it has focus. A plain NavigationMenuContent is the dropdown list of 3–8 links. A panel taller than the viewport scrolls in a Scroll Area.

'use client'

import * as React from 'react'
import { Search } from '@fairgarden/design/forms/search'
import {
  NavigationMenu,
  NavigationMenuContent,
  NavigationMenuFeatured,
  NavigationMenuGroup,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuPromo,
  NavigationMenuTrigger,
} from '@fairgarden/design/navigation/navigation-menu'
import { photo } from './photo'
import styles from './overview.module.css'

/**
 * Three overview panels and one dropdown. The page sits in
 * Programs › Garden Programs, so Programs shows the parent-of-current bar
 * and Garden Programs is current inside its panel.
 */
export function NavigationMenuOverview() {
  return (
    <div className={styles.frame}>
      <NavigationMenu currentPath="/programs/gardens" className={styles.bar}>
        <NavigationMenuItem>
          <NavigationMenuTrigger section="/our-work">Our Work</NavigationMenuTrigger>
          <NavigationMenuContent
            kind="overview"
            featured={
              <NavigationMenuFeatured
                href="/our-work"
                description="Why shared gardens make stronger towns."
              >
                Our Work
              </NavigationMenuFeatured>
            }
            promo={
              <NavigationMenuPromo
                href="/our-work/grown-close-to-home"
                title="Grown Close to Home"
                image={<img src={photo} alt="Raised beds on a hillside above a river valley" />}
              >
                Shared plots cool our streets, feed our families and bring neighbors out.
              </NavigationMenuPromo>
            }
          >
            <NavigationMenuGroup heading="Stewardship" href="/our-work/stewardship">
              <NavigationMenuLink href="/our-work/stewardship/why-grow">Why grow together</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/stewardship/agreements">
                Garden land agreements
              </NavigationMenuLink>
              <NavigationMenuLink href="/our-work/stewardship/stewards">
                What a garden steward does
              </NavigationMenuLink>
              <NavigationMenuLink href="/our-work/stewardship/soil">
                Caring for soil for good
              </NavigationMenuLink>
            </NavigationMenuGroup>
            <NavigationMenuGroup heading="Priorities" href="/our-work/priorities">
              <NavigationMenuLink href="/our-work/priorities/climate">Climate</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/priorities/water">Clean water</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/priorities/food">Local food</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/priorities/pollinators">Pollinator habitat</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/priorities/neighbors">
                Neighbor-led stewardship
              </NavigationMenuLink>
            </NavigationMenuGroup>
          </NavigationMenuContent>
        </NavigationMenuItem>

        <NavigationMenuItem>
          <NavigationMenuTrigger section="/programs">Programs</NavigationMenuTrigger>
          <NavigationMenuContent
            kind="overview"
            featured={
              <NavigationMenuFeatured
                href="/programs"
                description="We help neighbors start, tend and keep the gardens they love."
              >
                Programs
              </NavigationMenuFeatured>
            }
            promo={
              <NavigationMenuPromo
                href="/programs/every-block"
                title="Together, Let's Grow Every Block"
                image={<img src={photo} alt="Volunteers planting along a creek" />}
              >
                See how new plots opened this year, from school yards to church lots.
              </NavigationMenuPromo>
            }
          >
            <NavigationMenuGroup heading="Garden Programs" href="/programs/gardens">
              <NavigationMenuLink href="/programs/gardens/plot-matching">Plot matching</NavigationMenuLink>
              <NavigationMenuLink href="/programs/gardens/seed-library">Seed library</NavigationMenuLink>
              <NavigationMenuLink href="/programs/gardens/tool-share">Tool share</NavigationMenuLink>
              <NavigationMenuLink href="/programs/gardens/grants">Grants</NavigationMenuLink>
              <NavigationMenuLink href="/programs/gardens/training">Training and events</NavigationMenuLink>
            </NavigationMenuGroup>
            <NavigationMenuGroup heading="Our Impact" href="/programs/impact">
              <NavigationMenuLink href="/programs/impact/harvest">Annual harvest count</NavigationMenuLink>
              <NavigationMenuLink href="/programs/impact/stories">Garden stories</NavigationMenuLink>
              <NavigationMenuLink href="/programs/impact/annual-report">Annual report</NavigationMenuLink>
            </NavigationMenuGroup>
          </NavigationMenuContent>
        </NavigationMenuItem>

        <NavigationMenuItem>
          <NavigationMenuTrigger section="/get-involved">Get Involved</NavigationMenuTrigger>
          <NavigationMenuContent
            kind="overview"
            featured={
              <NavigationMenuFeatured href="/get-involved" description="Ways to pitch in this season.">
                Get Involved
              </NavigationMenuFeatured>
            }
            search={<Search label="Find a garden near you" placeholder="Search by street or town…" />}
            promo={
              <NavigationMenuPromo
                href="/get-involved/give/keepers"
                title="Join the Garden Keepers"
                image={<img src={photo} alt="A gardener watering raised beds at dusk" />}
              >
                Monthly gifts keep shared gardens tended, season after season.
              </NavigationMenuPromo>
            }
          >
            <NavigationMenuGroup heading="Volunteer" href="/get-involved/volunteer">
              <NavigationMenuLink href="/get-involved/volunteer/work-days">Join a work day</NavigationMenuLink>
              <NavigationMenuLink href="/get-involved/volunteer/events">Find an event</NavigationMenuLink>
              <NavigationMenuLink href="/get-involved/volunteer/story">Share your story</NavigationMenuLink>
            </NavigationMenuGroup>
            <NavigationMenuGroup heading="Share Your Land" href="/get-involved/share-land">
              <NavigationMenuLink href="/get-involved/share-land/options">Lending options</NavigationMenuLink>
              <NavigationMenuLink href="/get-involved/share-land/tax">Tax benefits</NavigationMenuLink>
              <NavigationMenuLink href="/get-involved/share-land/talk">Talk to our team</NavigationMenuLink>
            </NavigationMenuGroup>
            <NavigationMenuGroup heading="Give" href="/get-involved/give">
              <NavigationMenuLink href="/get-involved/give/donate">Donate</NavigationMenuLink>
              <NavigationMenuLink href="/get-involved/give/monthly">Give monthly</NavigationMenuLink>
              <NavigationMenuLink href="/get-involved/give/legacy">Leave a legacy</NavigationMenuLink>
            </NavigationMenuGroup>
            <NavigationMenuGroup heading="Partner" href="/get-involved/partner">
              <NavigationMenuLink href="/get-involved/partner/business">Business partnerships</NavigationMenuLink>
            </NavigationMenuGroup>
          </NavigationMenuContent>
        </NavigationMenuItem>

        <NavigationMenuItem>
          <NavigationMenuTrigger section="/about">About</NavigationMenuTrigger>
          <NavigationMenuContent>
            <NavigationMenuLink href="/about/story">Our story</NavigationMenuLink>
            <NavigationMenuLink href="/about/staff">Staff and board</NavigationMenuLink>
            <NavigationMenuLink href="/about/careers">Careers</NavigationMenuLink>
            <NavigationMenuLink href="/about/contact">Contact</NavigationMenuLink>
          </NavigationMenuContent>
        </NavigationMenuItem>
      </NavigationMenu>
    </div>
  )
}

Index panels

Index panels

kind="index" is a nested vertical menu: NavigationMenuCategory rows (a --size-px-13 column at a 44 px pitch) beside the selected category's link pane, with a featuredBar across both. One category is always selected: the one holding the current page, else the first. It is marked by a --border-size-2-25 start-edge bar and weight 700. Categories switch on click, Enter or mouse rest. The panel attaches at its trigger's start edge, end-aligns inside the content container, and takes square top and --radius-2-25 bottom corners.

'use client'

import * as React from 'react'
import {
  NavigationMenu,
  NavigationMenuCategory,
  NavigationMenuContent,
  NavigationMenuFeaturedBar,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuTrigger,
} from '@fairgarden/design/navigation/navigation-menu'
import styles from './index-panel.module.css'

/**
 * Index panels: a category list beside the selected category's links,
 * with a featured bar across both. The page is a plant profile, so
 * Garden Guide is the parent of current and Plant Profiles opens
 * selected.
 */
export function NavigationMenuIndex() {
  return (
    <div className={styles.frame}>
      <NavigationMenu currentPath="/guide/plants/butternut-squash" className={styles.bar}>
        <NavigationMenuItem>
          <NavigationMenuTrigger section="/our-work">Our Work</NavigationMenuTrigger>
          <NavigationMenuContent
            kind="index"
            featuredBar={
              <NavigationMenuFeaturedBar href="/our-work">See All of Our Work</NavigationMenuFeaturedBar>
            }
          >
            <NavigationMenuCategory label="Stewardship">
              <NavigationMenuLink href="/our-work/stewardship/meadows">Meadows</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/stewardship/hedgerows">Orchards and hedgerows</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/stewardship/rain-gardens">Rain gardens</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/stewardship/soil">Soil and compost</NavigationMenuLink>
            </NavigationMenuCategory>
            <NavigationMenuCategory label="Climate">
              <NavigationMenuLink href="/our-work/climate/report">Cooler blocks report</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/climate/shade">Shade and tree canopy</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/climate/rain">Rain capture</NavigationMenuLink>
            </NavigationMenuCategory>
            <NavigationMenuCategory label="Garden Science">
              <NavigationMenuLink href="/our-work/science/count">Pollinator count</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/science/soil">Soil testing</NavigationMenuLink>
              <NavigationMenuLink href="/our-work/science/data">Open data</NavigationMenuLink>
            </NavigationMenuCategory>
          </NavigationMenuContent>
        </NavigationMenuItem>

        <NavigationMenuItem>
          <NavigationMenuTrigger section="/guide">Garden Guide</NavigationMenuTrigger>
          <NavigationMenuContent
            kind="index"
            featuredBar={
              <NavigationMenuFeaturedBar href="/guide/for-your-plot">
                Find Plants That Suit Your Plot
              </NavigationMenuFeaturedBar>
            }
          >
            <NavigationMenuCategory label="Visit">
              <NavigationMenuLink href="/guide/visit/map">Garden map</NavigationMenuLink>
              <NavigationMenuLink href="/guide/visit/walks">Guided walks</NavigationMenuLink>
              <NavigationMenuLink href="/guide/visit/seed-libraries">Seed libraries</NavigationMenuLink>
            </NavigationMenuCategory>
            <NavigationMenuCategory label="Plant Profiles">
              <NavigationMenuLink href="/guide/plants/squashes">Squashes</NavigationMenuLink>
              <NavigationMenuLink href="/guide/plants/butternut-squash">Butternut squash</NavigationMenuLink>
              <NavigationMenuLink href="/guide/plants/beans">Beans</NavigationMenuLink>
              <NavigationMenuLink href="/guide/plants/leafy-greens">Leafy greens</NavigationMenuLink>
            </NavigationMenuCategory>
            <NavigationMenuCategory label="Grow at Home">
              <NavigationMenuLink href="/guide/home/native-plants">Native plants</NavigationMenuLink>
              <NavigationMenuLink href="/guide/home/containers">Container beds</NavigationMenuLink>
              <NavigationMenuLink href="/guide/home/compost">Compost and mulch</NavigationMenuLink>
            </NavigationMenuCategory>
            <NavigationMenuCategory label="Photography">
              <NavigationMenuLink href="/guide/photo/contest">Photo contest</NavigationMenuLink>
              <NavigationMenuLink href="/guide/photo/tips">Garden photo tips</NavigationMenuLink>
            </NavigationMenuCategory>
          </NavigationMenuContent>
        </NavigationMenuItem>

        <NavigationMenuItem>
          <NavigationMenuTrigger section="/get-involved">Get Involved</NavigationMenuTrigger>
          <NavigationMenuContent>
            <NavigationMenuLink href="/get-involved/volunteer">Volunteer</NavigationMenuLink>
            <NavigationMenuLink href="/get-involved/gardens">Find a garden</NavigationMenuLink>
            <NavigationMenuLink href="/get-involved/advocate">Advocate</NavigationMenuLink>
          </NavigationMenuContent>
        </NavigationMenuItem>

        <NavigationMenuItem>
          <NavigationMenuLink href="/news">News</NavigationMenuLink>
        </NavigationMenuItem>
      </NavigationMenu>
    </div>
  )
}

API Reference

The desktop site navigation [D182]: a nav labelled “Main” holding the bar’s items. Triggers are buttons that open their panel on click, Enter, Space or ArrowDown, and on hover intent under a mouse (--fgd-delay-nav-open, closing --fgd-delay-nav-close after the pointer leaves); focus alone never opens one. Opening from the keyboard moves focus to the panel’s first link; Escape closes and returns focus to the trigger. Panels attach at 0 offset under the bar’s bottom rule, switch instantly and scroll in a Scroll Area when taller than the viewport.

PropTypeDescription
label
string | undefined

The landmark’s name. Default “Main”.

currentPath
string | undefined

The current page’s URL path. A link whose path equals it is current (aria-current="page"); a bar item whose section is a path prefix of it is the parent of current (aria-current="true"). Inside a Navigation Bar it defaults to the bar’s currentPath.

primary
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| null
| undefined

Primary Radix scale for the bar’s parts: labels, bars and focus ring. Never defaulted; omitted, it inherits the scope [D133]. The panels keep the white preset’s scales.

secondary
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| 'amber'
| 'blue'
| 'cyan'
| 'grass'
| 'green'
| 'jade'
| 'lime'
| 'mint'
| 'orange'
| 'sky'
| 'teal'
| 'yellow'
| null
| undefined

Secondary Radix scale for the bar’s parts: the chevrons and the hover underline (--role-glyph, --role-accent). Never defaulted.

children
React.ReactNode | undefined

NavigationMenuItems, in bar order.

One bar item: a NavigationMenuTrigger with its NavigationMenuContent, or a plain NavigationMenuLink. value identifies it when the menu is controlled; omitted, one is generated.

A bar trigger: a button with a caps label (type-label, [D165]) and the expand_more chevron in --role-glyph, which flips while open. It opens its panel on click, Enter, Space, ArrowDown or mouse hover intent, never on focus alone; the section’s landing page is the panel’s first link.

PropTypeDescription
section
string | undefined

The path of the section this trigger opens (/what-we-do). While the page lies in it, the trigger is the parent of current (aria-current="true", the --border-size-2 bar) [D182].

A link. In the bar it is a caps item with no rest underline; in a panel it is a type-body-ui row at a --fgd-size-hit pitch in Link’s list-link build (kind="nav" with list), whose hover is --role-link-hover only (§9.3) [D181]. active defaults to “its path is the current page” (aria-current="page"); a bar link whose path is a prefix of the page is the parent of current. Panel links close the panel on click.

A panel. It renders in the menu’s portaled white overlay scope, attached under the bar’s bottom rule: overview full-bleed with its content on the 12-column grid of --fgd-container-content; index and dropdown at the trigger’s start edge, end-aligned to the content container, with square top and --radius-2-25 bottom corners.

PropTypeDescription
featured
React.ReactNode | undefined
featuredBar
React.ReactNode | undefined
kind
'dropdown' | 'overview' | 'index' | undefined

dropdown (default): a simple list panel of 3–8 NavigationMenuLinks.

promo
React.ReactNode | undefined
search
React.ReactNode | undefined
children
React.ReactNode | undefined

Overview parts: NavigationMenuFeatured, NavigationMenuGroup and NavigationMenuPromo

The overview link (featured): the trigger’s own section landing page, a type-itemhead serif link in --role-heading with a trailing › in --role-accent, then its description. Put it in featured.

PropTypeDescription
description
React.ReactNode | undefined

One line of type-body-ui in --role-muted under the link.

A caps link group in an overview panel: a heading (a link with › when href is given) over its links at a --fgd-size-hit pitch.

PropTypeDescription
heading
React.ReactNode | undefined

The group heading, set in type-label caps.

href
string | undefined

Makes the heading a link with a trailing ›, to the group’s landing page.

children
React.ReactNode | undefined

The group’s NavigationMenuLinks.

The optional promo card of an overview panel (≤ 1 per panel): a §12.2 card with a 16:9 image, a stretched title link (one Tab stop) and a blurb. Its hover is the title link’s --role-link-hover; no shadow.

PropTypeDescription
href
string

The destination: the card’s one Tab stop, its stretched title link.

image
React.ReactNode | undefined

A 16:9 image (an img with its alt).

title
React.ReactNode

The title, type-itemhead.

children
React.ReactNode | undefined

A two-line type-body-ui blurb.

className
string | undefined

Class names for the card, added after its own.

Index parts: NavigationMenuCategory and NavigationMenuFeaturedBar

One category of an index panel: a row in the category list (a trigger of the nested vertical menu) and its links in the pane. The selected category takes a --border-size-2-25 start-edge bar and --font-weight-7.

PropTypeDescription
label
React.ReactNode

The category row’s label.

value
string | undefined

Identifies the category; omitted, the panel assigns one.

children
React.ReactNode | undefined

The category’s NavigationMenuLinks, shown in the link pane.

className
string | undefined

Class names for the category row, added after its own.

The featured bar of an index panel: one type-itemhead link with a › in --role-glyph, across both panes above a --role-hairline rule. Put it in featuredBar.

Additional types

NAV_DELAY_MS
navigationMenu
NavigationMenuCategoryProps
navigationMenuContent
NavigationMenuContentKind
NavigationMenuContentProps
NavigationMenuFeaturedBarProps
NavigationMenuFeaturedProps
NavigationMenuFrame
NavigationMenuFrameContext
NavigationMenuGroupProps
NavigationMenuItemProps
NavigationMenuLinkProps
NavigationMenuPromoProps
NavigationMenuProps
NavigationMenuSectionsProps
NavigationMenuTriggerProps

Specification: DESIGN-SYSTEM.md §9.6 (navigation menu) [D181, D182], with the overlay panels of §9.1 and the fit budget of §11.5 [D183].