Unified UI

Command Palette

A keyboard-navigable command palette modal with fuzzy search, grouped commands, and ⌘K shortcut. No external dependencies.

Overview

Command is a fully-accessible command palette dialog — the kind you see when pressing ⌘K in apps like Linear, Vercel, or Notion. It features real-time fuzzy search, grouped commands, keyboard navigation, and a built-in ⌘K global shortcut. No external command libraries required.


Installation

Install the component via the CLI in one command.

npx @work-rjkashyap/unified-ui add command
pnpm dlx @work-rjkashyap/unified-ui add command
npx @work-rjkashyap/unified-ui add command
bunx @work-rjkashyap/unified-ui add command

If you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.

Or install the full package

Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.

npm install @work-rjkashyap/unified-ui
pnpm add @work-rjkashyap/unified-ui
yarn add @work-rjkashyap/unified-ui
bun add @work-rjkashyap/unified-ui

Anatomy

import {
	Command,
	CommandTrigger,
} from "@work-rjkashyap/unified-ui";

Examples

Basic

or press ⌘K

With Icons

Disabled Items


Props

Command

PropTypeDefaultDescription
openboolean—Required. Controlled open state.
onOpenChange(open: boolean) => void—Required. Callback when open state changes.
groupsCommandGroup[]—Required. Array of grouped command items.
placeholderstring"Search commands..."Placeholder text for the search input.
emptyTextstring"No results found."Text shown when search returns no results.
shortcutKeystring"k"Key for the ⌘+key global shortcut to open the palette.

CommandGroup

PropTypeDescription
headingstringOptional group heading displayed above the items.
itemsCommandItem[]Required. Array of command items in this group.

CommandItem

PropTypeDefaultDescription
idstring—Required. Unique identifier for the command.
labelstring—Required. Display label for the command.
onSelect() => void—Required. Called when the command is selected.
descriptionstring—Optional secondary text beneath the label.
iconReactNode—Optional icon rendered before the label.
shortcutstring—Keyboard shortcut hint displayed on the right (⌘N, etc.).
disabledbooleanfalseExcludes this item from keyboard navigation and click.

CommandTrigger

PropTypeDefaultDescription
onClick() => void—Required. Called when the button is clicked.
labelstring"Search commands..."Label text displayed in the trigger button.
classNamestring—Additional CSS classes.

Keyboard Navigation

KeyAction
⌘K / Ctrl+KOpens the command palette globally.
↑ / ↓Navigate between commands.
EnterExecute the highlighted command.
EscapeClose the palette.
Type to searchFilters commands in real-time.

Accessibility

The command palette uses role="combobox" on the input and role="listbox" on the results, with aria-activedescendant tracking the highlighted item.

  • role="combobox" on the search input with aria-expanded and aria-controls.
  • role="listbox" on the results container.
  • role="option" and aria-selected on each command item.
  • aria-disabled on disabled items.
  • aria-activedescendant tracks the currently highlighted item.
  • Focus is trapped within the dialog when open.

On this page