command-menu component

Drop-in semantic component. See examples, sizes, variants, and source.

Keyboard-driven command palette for fast navigation and actions. Compose a command-menu-overlay wrapping a command-menu, then add a header (search input), a list of item rows (optionally grouped under group with a group-label), and an optional footer. Triggers use the data-command-menu attribute and the menu is opened/searched/navigated by command-menu.js.

Command Menu System

  1. Trigger - Keyboard shortcut or button with data-command-menu attribute
  2. Search - Fuzzy search to filter commands quickly
  3. Navigation - Arrow keys to navigate, Enter to select, Esc to close

Basic Command Menu

or press Cmd+K

Grouped Commands

Commands with Groups

Command Menu Sizes

Tiny Command Menu

Small Command Menu

Large Command Menu

Big Command Menu

Command Menu States

Empty State

Loading State

Inline Command Search

Inline Command Menu

Go to Dashboard G D
View Profile G P
Settings G S
Help ?

Interactive Commands

Commands with Actions

Class API Reference

Type Class Usage Notes
Base command-menu-overlay Full-screen overlay that hosts the menu Toggle hidden / active via JS
command-menu The menu container itself Holds header, list, footer
data-command-menu Trigger attribute — value matches menu id Wired by command-menu.js
Sizes xs 320px wide — tiny Modifier on command-menu
sm 448px wide — small Modifier on command-menu
(default) 600px wide — medium No size class needed
xl 768px wide — large Modifier on command-menu
lg 896px wide — big Modifier on command-menu
Structure header Top section with the search input Child of command-menu
search Search <input> inside the header Filters items as you type
list Scrollable container of items / groups Child of command-menu
group Wraps related items under a heading Child of list
group-label Heading text for a group First child of group
item A single command row Add data-command="..." for JS hooks
label Item title text Inside item
description Secondary text below the label Inside item .content
shortcut Right-aligned <kbd> hint Inside item
States active Currently selected item (keyboard focus) Toggled by JS during arrow-key navigation
disabled Non-interactive item Modifier on item
hidden Closed overlay state Toggle on command-menu-overlay
empty No-results placeholder block Pair with empty-icon, empty-title, empty-description
loading Loading placeholder block Contains spinner
Variant inline Embeds the menu in-page (no overlay) Modifier on command-menu
footer Bottom hint bar with kbd legend Optional child of command-menu