Navigation menu example

Product navigation with shared flyouts.

Move between product links and learning resources. Real links retain their destinations, and the current page is marked separately from the open flyout.

Complete React client module · MIT · Next.js and Vite

Interactive example

Product navigation with shared flyouts

Move between product links and learning resources. Real links retain their destinations, and the current page is marked separately from the open flyout.

Keyboard

  • Tab reaches the navigation. Arrow keys move between top-level items.
  • Enter, Space or Arrow Down opens a flyout. Tab or arrow keys reach its links.
  • Escape closes the flyout and returns focus. Selecting a destination closes it.

States covered

  • Uncontrolled flyout
  • Current page link
  • Shared viewport resize
  • Disabled destination
  • Real section navigation

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-navigation-product.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuGroup, NavigationMenuPopup } from '@bld8/ui/navigation-menu';
import { Layers, BarChart3, BookOpen } from 'lucide-react';

export function ProductNavigationExample() {
  return <div style={{ width: '100%', display: 'grid', gap: 24 }}>
    <NavigationMenu aria-label="Product navigation">
      <NavigationMenuList>
        <NavigationMenuItem value="product">
          <NavigationMenuTrigger>Product</NavigationMenuTrigger>
          <NavigationMenuContent>
            <NavigationMenuGroup label="Workspace">
              <NavigationMenuLink href="#nav-product-projects" description="Organise project records and review current work."><Layers size={16} aria-hidden="true" />Projects</NavigationMenuLink>
              <NavigationMenuLink href="#nav-product-reports" description="Inspect the weekly delivery snapshot."><BarChart3 size={16} aria-hidden="true" />Reports</NavigationMenuLink>
              <NavigationMenuLink disabled href="#nav-product-audit" description="This destination is not available in the example.">Audit log</NavigationMenuLink>
            </NavigationMenuGroup>
          </NavigationMenuContent>
        </NavigationMenuItem>
        <NavigationMenuItem value="learn">
          <NavigationMenuTrigger>Learn</NavigationMenuTrigger>
          <NavigationMenuContent><NavigationMenuGroup label="Resources">
            <NavigationMenuLink href="#nav-product-guide" description="A short guide to your first project."><BookOpen size={16} aria-hidden="true" />Quick start</NavigationMenuLink>
          </NavigationMenuGroup></NavigationMenuContent>
        </NavigationMenuItem>
        <NavigationMenuItem><NavigationMenuLink href="#nav-product-plan" active>Plan</NavigationMenuLink></NavigationMenuItem>
      </NavigationMenuList>
      <NavigationMenuPopup popupProps={{ 'aria-label': 'Product destinations' }} />
    </NavigationMenu>
    <div style={{ display: 'grid', gap: 12 }}>
      <section id="nav-product-projects"><strong>Projects</strong><p className="bui-hint">Create a project record, assign an owner and review its current stage.</p></section>
      <section id="nav-product-reports"><strong>Reports</strong><p className="bui-hint">The weekly delivery snapshot groups active work by stage.</p></section>
      <section id="nav-product-guide"><strong>Quick start</strong><p className="bui-hint">Start with a name, owner and target date. Save the record before sharing its link.</p></section>
      <section id="nav-product-plan"><strong>Current plan</strong><p className="bui-hint">Example destinations are sections on this page. Replace href values with your application routes.</p></section>
    </div>
  </div>;
}