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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@aiquants/menu-bar

v1.8.0

Published

A React menu bar component with authentication support and theming

Readme

@aiquants/menu-bar

A React menu bar component with authentication support and theming for modern web applications.

Key Features

  • Menu Navigation: Collapsible menu with smooth animations and hierarchical structure
  • Dark/Light Theme: Comprehensive theming support with scoped CSS
  • Session Management: Built-in session information display with user profiles
  • Responsive Design: Mobile-friendly with overlay support
  • TypeScript Support: Full TypeScript definitions included
  • React Router Integration: Built for React Router with generic link component support
  • CSS Scoped: All styles are scoped to prevent conflicts with host applications

Installation

npm install @aiquants/menu-bar

Exports

This package exports the following components and types:

// Components
export { MenuBar } from '@aiquants/menu-bar';
export { SessionInfo, DefaultLink } from '@aiquants/menu-bar';

// Types
export type { IMenu, ISubmenu } from '@aiquants/menu-bar';
export type { Theme } from '@aiquants/menu-bar';
export type { SessionInfoProps, LinkProps } from '@aiquants/menu-bar';
export type { UserProfile, UserPhoto } from '@aiquants/menu-bar';

// CSS (import separately)
import '@aiquants/menu-bar/css';

Basic Usage

import React, { useState } from 'react';
import { MenuBar } from '@aiquants/menu-bar';
import '@aiquants/menu-bar/css';

function App() {
  const [theme, setTheme] = useState('light');

  const menuList = [
    {
      id: 1,
      title: 'Dashboard',
      href: '/dashboard',
      submenu: []
    },
    {
      id: 2,
      title: 'Data',
      submenu: [
        { subid: 1, title: 'Reports', href: '/data/reports' },
        { subid: 2, title: 'Analytics', href: '/data/analytics' }
      ]
    }
  ];

  const toggleTheme = () => {
    setTheme(prevTheme => prevTheme === 'light' ? 'dark' : 'light');
  };

  const handleSignout = () => {
    console.log('Signing out...');
  };

  return (
    <div className="app">
      <MenuBar
        menuList={menuList}
        theme={theme}
        toggleTheme={toggleTheme}
        onClickSignout={handleSignout}
        menuHeader={<div>My App</div>}
      />
      {/* Your app content */}
    </div>
  );
}

Props

MenuBar Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | menuList | IMenu[] | Yes | Array of menu items to display | | theme | 'light' \| 'dark' | Yes | Theme mode for the menu bar | | toggleTheme | () => void | Yes | Function to toggle between light and dark themes | | onClickSignout | () => void | Yes | Callback function for sign out action | | menuHeader | React.ReactNode | No | Optional header content for the menu | | isMenuhide | boolean | No | Whether to hide the menu bar entirely |

IMenu Type

interface IMenu {
  id: number;
  title: string;
  href?: string;
  submenu: ISubmenu[];
}

ISubmenu Type

interface ISubmenu {
  subid: number;
  title?: string;
  href: string;
  mark?: string;
  new?: boolean;
}

UserProfile Type

interface UserProfile {
  displayName: string;
  photos: UserPhoto[];
  id?: string;
}

interface UserPhoto {
  value: string;
}

SessionInfoProps Type

interface SessionInfoProps {
  user: UserProfile | null;
  onLogout?: () => void;
  LinkComponent: React.ComponentType<LinkProps>;
}

interface LinkProps {
  to: string;
  className?: string;
  children: React.ReactNode;
}

Theming

The menu bar supports both light and dark themes. All styles are scoped with the .aiquants-menu-bar class to prevent conflicts with your application's styles.

Custom Styling

You can override the default styles by targeting the scoped classes:

.aiquants-menu-bar {
  /* Custom menu bar styles */
}

.aiquants-menu-bar.theme-dark {
  /* Dark theme overrides */
}

.aiquants-menu-bar.theme-light {
  /* Light theme overrides */
}

Usage with React Router

import React, { useState } from 'react';
import { MenuBar } from '@aiquants/menu-bar';

function App() {
  const [theme, setTheme] = useState('light');

  const menuList = [
    {
      id: 1,
      title: 'Home',
      href: '/',
      submenu: []
    },
    {
      id: 2,
      title: 'Products',
      submenu: [
        { subid: 1, title: 'All Products', href: '/products' },
        { subid: 2, title: 'Categories', href: '/products/categories' }
      ]
    }
  ];

  return (
    <MenuBar
      menuList={menuList}
      theme={theme}
      toggleTheme={() => setTheme(theme === 'light' ? 'dark' : 'light')}
      onClickSignout={() => console.log('Signout')}
    />
  );
}

Advanced Usage

With Menu Header

import React from 'react';

const menuHeader = (
  <div className="flex items-center gap-2 p-4">
    <img src="/logo.png" alt="Logo" className="w-8 h-8" />
    <span className="font-bold">My Application</span>
  </div>
);

<MenuBar
  menuList={menuList}
  menuHeader={menuHeader}
  theme={theme}
  toggleTheme={toggleTheme}
  onClickSignout={handleSignout}
/>

Hiding the Menu

import React from 'react';

<MenuBar
  menuList={menuList}
  theme={theme}
  toggleTheme={toggleTheme}
  onClickSignout={handleSignout}
  isMenuhide={shouldHideMenu}
/>

Components

MenuBar

The main menu bar component that includes:

  • Menu toggle button with hamburger icon
  • Company logo and navigation menu
  • Theme toggle functionality
  • Responsive overlay for mobile devices
  • Sign out functionality

SessionInfo

A standalone session information component that displays:

  • User avatar/profile picture
  • User display name
  • Logout functionality with customizable link component
import { SessionInfo } from '@aiquants/menu-bar';

<SessionInfo
  user={{
    displayName: "John Doe",
    photos: [{ value: "https://example.com/avatar.jpg" }]
  }}
  onLogout={() => console.log('Logout')}
  LinkComponent={({ to, children, ...props }) => (
    <a href={to} {...props}>{children}</a>
  )}
/>

Menu Features

  • Hierarchical Menu Structure: Support for main menu items with submenus
  • Dynamic Navigation: Menu items can have direct links or submenu collections
  • Visual Indicators: Support for special marks (lock icon, etc.) and "new" badges
  • External Links: Option to open links in new tabs

CSS Classes

All CSS classes are scoped with .aiquants- prefix:

  • .aiquants-menu-bar - Main container
  • .aiquants-menu-switch - Menu toggle button
  • .aiquants-menu-content - Menu content area
  • .aiquants-session-info - Session information
  • .aiquants-overlay-shadow - Mobile overlay

Browser Support

  • Chrome/Edge 88+
  • Firefox 78+
  • Safari 14+
  • Node.js 18+

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run type checking
npm run typecheck

# Clean build files
npm run clean

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

fehde-k