Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-navigation-menu

Package Overview
Dependencies
Maintainers
0
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-navigation-menu

  • 1.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
840K
decreased by-1.63%
Maintainers
0
Weekly downloads
 
Created

What is @radix-ui/react-navigation-menu?

@radix-ui/react-navigation-menu is a React component library that provides accessible and customizable navigation menus. It is part of the Radix UI suite, which focuses on providing unstyled, accessible components that can be easily styled to fit any design system.

What are @radix-ui/react-navigation-menu's main functionalities?

Basic Navigation Menu

This code sample demonstrates how to create a basic navigation menu with three links: Home, About, and Contact. The NavigationMenu component wraps the entire menu, while NavigationMenuItem and NavigationMenuLink are used for individual menu items and links, respectively.

import { NavigationMenu, NavigationMenuItem, NavigationMenuLink } from '@radix-ui/react-navigation-menu';

function BasicMenu() {
  return (
    <NavigationMenu>
      <NavigationMenuItem>
        <NavigationMenuLink href="#home">Home</NavigationMenuLink>
      </NavigationMenuItem>
      <NavigationMenuItem>
        <NavigationMenuLink href="#about">About</NavigationMenuLink>
      </NavigationMenuItem>
      <NavigationMenuItem>
        <NavigationMenuLink href="#contact">Contact</NavigationMenuLink>
      </NavigationMenuItem>
    </NavigationMenu>
  );
}

Submenu

This code sample demonstrates how to create a navigation menu with a submenu. The Services menu item has a submenu with two links: Design and Development. The NavigationMenuSub, NavigationMenuSubTrigger, and NavigationMenuSubContent components are used to create the submenu structure.

import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, NavigationMenuSub, NavigationMenuSubTrigger, NavigationMenuSubContent } from '@radix-ui/react-navigation-menu';

function Submenu() {
  return (
    <NavigationMenu>
      <NavigationMenuItem>
        <NavigationMenuLink href="#home">Home</NavigationMenuLink>
      </NavigationMenuItem>
      <NavigationMenuItem>
        <NavigationMenuSub>
          <NavigationMenuSubTrigger>Services</NavigationMenuSubTrigger>
          <NavigationMenuSubContent>
            <NavigationMenuLink href="#design">Design</NavigationMenuLink>
            <NavigationMenuLink href="#development">Development</NavigationMenuLink>
          </NavigationMenuSubContent>
        </NavigationMenuSub>
      </NavigationMenuItem>
      <NavigationMenuItem>
        <NavigationMenuLink href="#contact">Contact</NavigationMenuLink>
      </NavigationMenuItem>
    </NavigationMenu>
  );
}

Custom Styling

This code sample demonstrates how to apply custom styling to the navigation menu. By adding className properties and importing a custom CSS file, you can style the menu to fit your design requirements.

import { NavigationMenu, NavigationMenuItem, NavigationMenuLink } from '@radix-ui/react-navigation-menu';
import './customStyles.css';

function CustomStyledMenu() {
  return (
    <NavigationMenu className="custom-menu">
      <NavigationMenuItem className="custom-item">
        <NavigationMenuLink className="custom-link" href="#home">Home</NavigationMenuLink>
      </NavigationMenuItem>
      <NavigationMenuItem className="custom-item">
        <NavigationMenuLink className="custom-link" href="#about">About</NavigationMenuLink>
      </NavigationMenuItem>
      <NavigationMenuItem className="custom-item">
        <NavigationMenuLink className="custom-link" href="#contact">Contact</NavigationMenuLink>
      </NavigationMenuItem>
    </NavigationMenu>
  );
}

Other packages similar to @radix-ui/react-navigation-menu

FAQs

Package last updated on 17 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc