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 commandpnpm dlx @work-rjkashyap/unified-ui add commandnpx @work-rjkashyap/unified-ui add commandbunx @work-rjkashyap/unified-ui add commandIf 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-uipnpm add @work-rjkashyap/unified-uiyarn add @work-rjkashyap/unified-uibun add @work-rjkashyap/unified-uiAnatomy
import {
Command,
CommandTrigger,
} from "@work-rjkashyap/unified-ui";Examples
Basic
or press ⌘K
With Icons
Disabled Items
Props
Command
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Required. Controlled open state. |
onOpenChange | (open: boolean) => void | — | Required. Callback when open state changes. |
groups | CommandGroup[] | — | Required. Array of grouped command items. |
placeholder | string | "Search commands..." | Placeholder text for the search input. |
emptyText | string | "No results found." | Text shown when search returns no results. |
shortcutKey | string | "k" | Key for the ⌘+key global shortcut to open the palette. |
CommandGroup
| Prop | Type | Description |
|---|---|---|
heading | string | Optional group heading displayed above the items. |
items | CommandItem[] | Required. Array of command items in this group. |
CommandItem
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | — | Required. Unique identifier for the command. |
label | string | — | Required. Display label for the command. |
onSelect | () => void | — | Required. Called when the command is selected. |
description | string | — | Optional secondary text beneath the label. |
icon | ReactNode | — | Optional icon rendered before the label. |
shortcut | string | — | Keyboard shortcut hint displayed on the right (⌘N, etc.). |
disabled | boolean | false | Excludes this item from keyboard navigation and click. |
CommandTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
onClick | () => void | — | Required. Called when the button is clicked. |
label | string | "Search commands..." | Label text displayed in the trigger button. |
className | string | — | Additional CSS classes. |
Keyboard Navigation
| Key | Action |
|---|---|
⌘K / Ctrl+K | Opens the command palette globally. |
↑ / ↓ | Navigate between commands. |
Enter | Execute the highlighted command. |
Escape | Close the palette. |
| Type to search | Filters 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 witharia-expandedandaria-controls.role="listbox"on the results container.role="option"andaria-selectedon each command item.aria-disabledon disabled items.aria-activedescendanttracks the currently highlighted item.- Focus is trapped within the dialog when open.
Steps
A multi-step wizard progress indicator with horizontal and vertical orientations, clickable navigation, and status states.
Sidebar
A composable, multi-variant application sidebar with collapsible groups, nested menus, icon-only mode, mobile sheet overlay, and keyboard shortcut toggle. Supports default, floating, and inset layouts.