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

mui-menubar

v2.0.1

Published

A React MenuBar component using Material-UI.

Readme

Ⓜ ─ mui-menubar ─ 🍫

build NPM Version codecov Code Climate code quality TypeScript

React MenuBar component built with Material-UI. Supports nested submenus, keyboard shortcuts, icons, and hover navigation.

Installation

npm install mui-menubar

Usage

import { MenuBar, MenuConfig } from 'mui-menubar';

const menuConfig: MenuConfig[] = [
  {
    label: 'File',
    items: [
      { kind: 'action', label: 'New', action: () => {}, shortcut: '⌘N' },
      { kind: 'divider' },
      { kind: 'action', label: 'Exit', action: () => {} }
    ]
  }
];

<MenuBar menuConfig={menuConfig} />

MenuConfig

Defines the structure of each top-level menu. Each menu contains:

  • label - Text displayed in the menu bar
  • items - Array of menu items (actions, dividers, or submenus)
  • id - Optional unique identifier
  • disabled - Optional flag to disable the entire menu

Menu Items

Three types of menu items:

Action

Executes a function when clicked.

{
  kind: 'action',
  label: 'Save',
  action: () => console.log('saved'),
  shortcut: '⌘S',
  icon: <SaveIcon />,
  disabled: false,
  selected: false
}

Divider

Visual separator between menu items.

{
  kind: 'divider'
}

Submenu

Nested menu that opens on hover. Supports infinite nesting depth.

{
  kind: 'submenu',
  label: 'Recent Files',
  icon: <FolderIcon />,
  items: [
    { kind: 'action', label: 'file1.txt', action: () => {} },
    { kind: 'action', label: 'file2.txt', action: () => {} }
  ]
}

Components

MenuBar - Horizontal bar that renders menu buttons. Handles activation state and hover navigation between menus. Clicking outside any menu closes all open menus.

MenuButton - Individual button in the menu bar. Opens a dropdown menu on click. Supports hover navigation when another menu is already open.

MenuItemAction - Leaf menu item that executes an action. Displays label, optional icon on left, and optional shortcut or icon on right. Supports selected and disabled states.

MenuItemSubmenu - Menu item that opens a submenu on hover. Default delay is 0ms but configurable. Displays chevron icon on the right by default.

renderMenuItem - Helper function that renders the appropriate component based on menu item kind (action, divider, or submenu).

Utilities

menuUtils.ts contains:

  • generateMenuItemKey() - Creates unique keys for React rendering using id, label, or random fallback
  • resolveMenuId() - Determines menu identifier from id or label
  • NESTED_MENU_SX - Shared styling for nested Menu components
  • Color and alpha constants for consistent theming across menu items

Props

MenuBar

interface MenuBarProps {
  menuConfig: MenuConfig[];
  sx?: SxProps<Theme>;
}

MenuButton

Internal component. Receives menu configuration, active state, and callbacks for activation/deactivation.

MenuItemAction

interface MenuItemActionProps {
  disabled?: boolean;
  label?: string;
  leftIcon?: ReactNode;
  onClick?: (event: MouseEvent<HTMLElement>) => void;
  rightIcon?: ReactNode;
  shortcut?: string;
  selected?: boolean;
}

MenuItemSubmenu

interface MenuItemSubmenuProps {
  parentMenuOpen: boolean;
  label?: string;
  rightIcon?: ReactNode;
  leftIcon?: ReactNode;
  children?: ReactNode;
  disabled?: boolean;
  delay?: number;
}

Behaviour

  • Click a menu button to open its menu
  • Click again or click outside to close
  • When a menu is open, hovering over other menu buttons switches to that menu
  • Submenus open on hover with configurable delay
  • Keyboard shortcuts are displayed but not handled by the component
  • Menus use zero transition duration for instant response

License

MIT