npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@b7r/react-navbar

v2.0.1

Published

This project is a flexible and customizable navigation bar built with React and Tailwind. It includes interactive components like dropdown menus.

Readme

react-navbar - Enhanced Accessible Navigation Bar

This project provides a flexible, customizable, and highly accessible navigation bar component built with React and Tailwind CSS. It has been significantly enhanced by integrating Radix UI Primitives to ensure robust accessibility (A11Y) and advanced features.

✨ Features

  • Enhanced Accessibility (A11Y): Leverages Radix UI for correct focus management, keyboard navigation, and ARIA attributes.
  • Mobile Menu: Rebuilt using Radix Dialog for a superior, accessible mobile experience.
  • User Profile Dropdown: Optional NavbarUser component for an accessible user menu.
  • Command Palette Search: Optional NavbarSearch component providing a modern, command-palette style search interface.
  • Improved CLI: A powerful Command Line Interface for easy installation of core and optional components.

🛠️ Installation

The component is designed to be installed directly into your project's source code using the provided CLI tool.

1. Install Dependencies

First, ensure you have the necessary peer dependencies installed:

npm install react react-dom class-variance-authority clsx tailwind-merge

2. Use the CLI to Install Components

Use the npx command to run the CLI tool and copy the component files into your project.

npx add-navbar --dir components/ui/navbar

Installing Optional Features

You can include the advanced features using the following flags:

| Flag | Description | Required Radix UI Dependency | | :--- | :--- | :--- | | --with-user-dropdown | Includes the NavbarUser component (User Profile Dropdown). | @radix-ui/react-dropdown-menu | | --with-search | Includes the NavbarSearch component (Command Palette style search). | @radix-ui/react-dialog |

Example: Full Installation

To install the core component, the user dropdown, and the search component into src/components/ui/navbar:

npx add-navbar --dir src/components/ui/navbar --with-user-dropdown --with-search

Important: After running the CLI, it will provide clear instructions on which Radix UI packages you need to install to support the optional components you selected.

💡 Usage Example

Here is a comprehensive example demonstrating how to use the core and optional components together:

import { 
  Navbar, 
  NavbarLogo, 
  NavbarContent, 
  NavbarMobile 
} from '@/components/ui/navbar/navbar'; // Adjust path based on your --dir flag

// Import optional components
import { NavbarUser, NavbarUserItem, NavbarUserSeparator } from '@/components/ui/navbar/navbar-user';
import { NavbarSearch } from '@/components/ui/navbar/navbar-search';

function App() {
  return (
    <div className="min-h-screen">
      <Navbar variant="default" sticky>
        <NavbarContent>
          <NavbarLogo href="/">
            <span className="text-xl font-bold">My App</span>
          </NavbarLogo>
        </NavbarContent>

        {/* Desktop Navigation */}
        <NavbarContent className="hidden md:flex">
          <ul className='flex gap-4 items-center'>
            <li><a href="/features" className="text-gray-600 hover:text-gray-900">Features</a></li>
            <li><a href="/pricing" className="text-gray-600 hover:text-gray-900">Pricing</a></li>
            
            {/* 1. Command Palette Search */}
            <li><NavbarSearch placeholder="Search (Cmd+K)" /></li>
            
            {/* 2. User Profile Dropdown */}
            <li>
              <NavbarUser avatarUrl="/path/to/avatar.jpg" userName="John Doe">
                <NavbarUserItem>Profile</NavbarUserItem>
                <NavbarUserItem>Settings</NavbarUserItem>
                <NavbarUserSeparator />
                <NavbarUserItem>Log Out</NavbarUserItem>
              </NavbarUser>
            </li>
          </ul>
        </NavbarContent>

        {/* Mobile Navigation */}
        <NavbarContent className="md:hidden">
          {/* 3. Accessible Mobile Menu */}
          <NavbarMobile side="right">
            <div className="flex flex-col gap-4">
              <a href="/features">Features</a>
              <a href="/pricing">Pricing</a>
              <a href="/about">About</a>
              <NavbarSearch placeholder="Search" />
            </div>
          </NavbarMobile>
        </NavbarContent>
      </Navbar>
      {/* ... rest of your application */}
    </div>
  );
}

🧩 Component API Reference

1. Core Components (navbar.tsx)

| Component | Description | Props | | :--- | :--- | :--- | | Navbar | The root container for the navigation bar. | variant: 'default' \| 'transparent' \| 'colored', sticky: boolean, className: string | | NavbarLogo | Component for the brand or logo. | href: string (optional), children: ReactNode | | NavbarContent | A flexible container for grouping navigation items (e.g., left, center, right groups). | className: string, children: ReactNode | | NavbarTrigger | The button element used to trigger the mobile menu (automatically used inside NavbarMobile). | className: string, children: ReactNode | | NavbarMobile | The accessible, Radix-powered mobile menu wrapper. | side: 'top' \| 'right' \| 'bottom' \| 'left' (controls slide direction), children: ReactNode |

2. Optional Components

NavbarUser (navbar-user.tsx)

A component for an accessible user profile dropdown menu.

| Component | Description | Props | | :--- | :--- | :--- | | NavbarUser | The main component wrapping the avatar and dropdown. | avatarUrl: string, userName: string, children: ReactNode (Dropdown items) | | NavbarUserItem | A clickable item within the dropdown menu. | Extends DropdownMenu.DropdownMenuItemProps | | NavbarUserSeparator | A visual separator line within the dropdown. | - |

NavbarSearch (navbar-search.tsx)

A component that triggers a Command Palette style search dialog.

| Component | Description | Props | | :--- | :--- | :--- | | NavbarSearch | The button that opens the search dialog. Supports Cmd+K / Ctrl+K shortcut. | placeholder: string, className: string |

⚙️ Development

To run the project locally for development or testing:

  1. Install dependencies: npm install
  2. Run the development server: npm run start

📄 License

MIT