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

@bw-ui/command-palette

v1.0.3

Published

Beautiful, accessible command palette for the web. Zero dependencies.

Readme

@bw-ui/command-palette

Beautiful, accessible command palette for the web. Zero dependencies.

npm version bundle size license

Live DemoDocumentationnpm

Features

  • Lightweight — ~6KB gzipped, zero dependencies
  • 🔍 Fuzzy Search — Smart matching with scoring and highlighting
  • ⌨️ Keyboard First — Full navigation with ↑↓ Enter Escape
  • 📱 Responsive — Works beautifully on mobile
  • 🎨 Themeable — Light, dark, or system preference
  • Accessible — Full ARIA support, focus trap, screen reader announcements
  • 🔄 Nested Commands — Drill-down submenus with breadcrumb navigation
  • ⏱️ Async Support — Load commands dynamically
  • 📜 Recent History — Remembers frequently used commands

Installation

npm install @bw-ui/command-palette

Quick Start

import { BWCommandPalette } from '@bw-ui/command-palette';
import '@bw-ui/command-palette/css';

const cmd = new BWCommandPalette({
  trigger: 'mod+k',
  commands: [
    {
      id: 'new-file',
      label: 'New File',
      icon: '📄',
      shortcut: 'mod+n',
      action: () => createFile(),
    },
    {
      id: 'settings',
      label: 'Settings',
      icon: '⚙️',
      children: [
        { id: 'theme', label: 'Theme', action: () => openTheme() },
        { id: 'account', label: 'Account', action: () => openAccount() },
      ],
    },
  ],
});

CDN Usage

<link
  rel="stylesheet"
  href="https://unpkg.com/@bw-ui/command-palette/dist/bw-command-palette.min.css"
/>
<script src="https://unpkg.com/@bw-ui/command-palette/dist/bw-command-palette.min.js"></script>

<script>
  const cmd = new BWCommandPalette({
    trigger: 'mod+k',
    commands: [
      { id: 'home', label: 'Go Home', action: () => (location.href = '/') },
    ],
  });
</script>

API

Options

| Option | Type | Default | Description | | --------------------- | ------------------------------- | ---------------------- | --------------------------------- | | trigger | string \| false | 'mod+k' | Hotkey to open (false to disable) | | commands | Command[] \| Function | [] | Commands array or async provider | | placeholder | string | 'Search commands...' | Input placeholder | | emptyMessage | string | 'No commands found' | Empty state message | | closeOnSelect | boolean | true | Close after selecting command | | closeOnClickOutside | boolean | true | Close on backdrop click | | maxResults | number | 50 | Maximum results to show | | debounceMs | number | 150 | Search debounce delay | | rememberRecent | boolean | true | Remember recent commands | | maxRecent | number | 5 | Max recent commands to remember | | theme | 'light' \| 'dark' \| 'system' | 'system' | Color theme | | width | string | '640px' | Dialog width | | maxHeight | string | '420px' | Max dialog height | | zIndex | number | 9999 | CSS z-index |

Command Object

{
  id: 'unique-id',           // Required: unique identifier
  label: 'Command Name',     // Required: display text
  icon: '📄',                // Optional: emoji, HTML, or element
  shortcut: 'mod+n',         // Optional: display-only shortcut hint
  keywords: ['create'],      // Optional: additional search terms
  group: 'File',             // Optional: group header
  description: 'Details',    // Optional: secondary text
  disabled: false,           // Optional: disable selection
  hidden: false,             // Optional: hide from results
  children: [],              // Optional: nested commands
  action: (cmd) => {},       // Optional: callback on select
}

Methods

cmd.open();              // Open palette
cmd.close();             // Close palette
cmd.toggle();            // Toggle open/close

cmd.setCommands([...]);  // Replace all commands
cmd.addCommand({...});   // Add a command
cmd.removeCommand('id'); // Remove by ID

cmd.on('open', () => {});
cmd.on('close', () => {});
cmd.on('select', (command) => {});
cmd.on('query', (query) => {});

cmd.destroy();           // Cleanup

Dynamic Commands

const cmd = new BWCommandPalette({
  commands: async (query) => {
    const results = await fetch(`/api/search?q=${query}`);
    return results.map((item) => ({
      id: item.id,
      label: item.name,
      action: () => navigate(item.url),
    }));
  },
});

Nested Commands

const cmd = new BWCommandPalette({
  commands: [
    {
      id: 'settings',
      label: 'Settings',
      icon: '⚙️',
      children: [
        {
          id: 'appearance',
          label: 'Appearance',
          children: [
            { id: 'light', label: 'Light', action: () => setTheme('light') },
            { id: 'dark', label: 'Dark', action: () => setTheme('dark') },
          ],
        },
      ],
    },
  ],
});

Styling

Customize with CSS variables:

.bw-cmd-root {
  --bw-cmd-bg: #ffffff;
  --bw-cmd-text: #1f2937;
  --bw-cmd-accent: #3b82f6;
  --bw-cmd-border: #e5e7eb;
  --bw-cmd-radius: 16px;
}

Browser Support

Chrome 80+, Firefox 75+, Safari 14+, Edge 80+

License

MIT © Black & White UI Engineering


Black & White UI — Engineered with Precision