# Command Centre

> A ⌘K command palette with recent actions, fuzzy search across pages and commands, and scope tabs.

Category: Navigation · MotionKit Plus · Updated 2026-11-14 · Live demo: https://www.motionkitui.com/components/command-centre

## When to use it

Larger web apps that need a full command palette: recent actions, search across pages and commands, and scope tabs.

## How it works

Every entry is ranked against the query: an exact prefix first, then a word start, then a substring, then letters in order, with tighter matches scoring higher. Recent actions are kept in localStorage and lead when the search is empty. Tab switches scope, the first Escape clears the search and the second closes it, and the platform's shortcut label (⌘ or Ctrl) is set after hydration.

## Installation

Part of MotionKit Plus (https://www.motionkitui.com/pricing). Subscribers install it with `npx shadcn@latest add @motionkit/command-centre` after adding their registry token from https://www.motionkitui.com/account.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `commands` | `CommandAction[]` |  | { id, label, onSelect, group?, icon?, shortcut?, keywords? } |
| `pages` | `CommandPage[]` |  | { label, href, description?, icon?, keywords? } |
| `onNavigate` | `(href: string) => void` | `window.location.assign` | Opens a page. Pass your router's push for client-side navigation. |
| `hotkey` | `string \| false` | `"k"` | Letter that opens it with ⌘ or Ctrl. false for none. |
| `storageKey` | `string \| null` | `"motionkit-command-centre"` | localStorage key for recent actions. null turns recents off. |
| `recentLimit` | `number` | `5` | How many recent actions to remember. |
| `placeholder` | `string` | `"Search pages and commands…"` | Search box placeholder. |
| `triggerLabel` | `string` | `"Search"` | Text on the trigger button. |

## Accessibility

- **Keyboard: Pass.** Opens from its button or ⌘K/Ctrl+K. Arrow keys move (Ctrl+N/P also work on Mac), Enter runs, Tab switches scope, Escape clears the search and then closes. Focus returns to the trigger.
- **Screen readers: Pass.** A labelled modal dialog with a combobox and listbox. The highlighted result is announced through aria-activedescendant, the result count through a polite live region, and the key hints are linked as the input's description.
- **Reduced motion: Pass.** With reduced motion on, the dialog fades only, and the highlight and scope tabs jump instead of gliding.
- **Colour contrast: Pass.** Results 15.5:1, matched letters 6.8:1, groups, hints and placeholder 7.1:1.
