Adds a command menu to the Payload admin panel, opened with a customizable keyboard shortcut or a search button. It lists collections and globals the user can access, supports searching documents within a collection, and can show live results from your own search endpoint. Custom items can link, call APIs or run client-side handlers. Requires Payload 3.37 or later.
A command menu plugin for Payload CMS to enhance navigation and accessibility within the admin panel.
Installation
npm i @veiag/payload-cmdk32
Stars
7
Forks
0
Open Issues
3 weeks ago
Last Updated
478
Weekly Downloads
v1.3.0
npm Version
263.1 KB
Unpacked Size
4
Dependencies
32+2 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 32 |
| Dec 4, 2026 | 32 |
| Dec 3, 2026 | 32 |
| Dec 2, 2026 | 32 |
| Dec 1, 2026 | 32 |
| Nov 30, 2026 | 32 |
| Nov 29, 2026 | 32 |
| Nov 28, 2026 | 32 |
| Nov 27, 2026 | 32 |
| Nov 26, 2026 | 32 |
| Nov 25, 2026 | 32 |
| Nov 24, 2026 | 32 |
| Nov 23, 2026 | 32 |
| Nov 22, 2026 | 32 |
| Nov 21, 2026 | 32 |
| Nov 20, 2026 | 32 |
| Nov 19, 2026 | 32 |
| Nov 18, 2026 | 32 |
| Nov 17, 2026 | 32 |
| Nov 16, 2026 | 32 |
| Nov 15, 2026 | 32 |
| Nov 14, 2026 | 32 |
| Nov 13, 2026 | 32 |
| Nov 12, 2026 | 32 |
| Nov 11, 2026 | 32 |
| Nov 10, 2026 | 31 |
| Nov 9, 2026 | 30 |
| Nov 8, 2026 | 30 |
| Nov 7, 2026 | 30 |
| Nov 6, 2026 | 30 |
| Nov 5, 2026 | 30 |
| Nov 4, 2026 | 30 |
| Nov 3, 2026 | 30 |
| Nov 2, 2026 | 30 |
| Nov 1, 2026 | 30 |
| Oct 31, 2026 | 30 |
| Oct 30, 2026 | 30 |
| Oct 29, 2026 | 30 |
| Oct 28, 2026 | 30 |
| Oct 27, 2026 | 30 |
| Oct 26, 2026 | 30 |
| Oct 25, 2026 | 30 |
| Oct 24, 2026 | 30 |
| Oct 23, 2026 | 30 |
| Oct 22, 2026 | 30 |
| Oct 21, 2026 | 30 |
| Oct 20, 2026 | 30 |
| Oct 19, 2026 | 30 |
| Oct 18, 2026 | 30 |
| Oct 17, 2026 | 30 |
| Oct 16, 2026 | 30 |
| Oct 15, 2026 | 30 |
| Oct 14, 2026 | 30 |
| Oct 13, 2026 | 30 |
| Oct 12, 2026 | 30 |
| Oct 11, 2026 | 30 |
| Oct 10, 2026 | 30 |
| Oct 9, 2026 | 30 |
| Oct 8, 2026 | 30 |
| Oct 7, 2026 | 30 |
| Oct 6, 2026 | 30 |
| Oct 5, 2026 | 30 |
| Oct 4, 2026 | 30 |
| Oct 3, 2026 | 30 |
| Oct 2, 2026 | 30 |
| Oct 1, 2026 | 30 |
| Sep 30, 2026 | 30 |
| Sep 29, 2026 | 30 |
| Sep 28, 2026 | 30 |
| Sep 27, 2026 | 30 |
| Sep 26, 2026 | 30 |
| Sep 25, 2026 | 30 |
| Sep 24, 2026 | 30 |
| Sep 23, 2026 | 30 |
| Sep 22, 2026 | 30 |
| Sep 21, 2026 | 30 |
| Sep 20, 2026 | 30 |
| Sep 19, 2026 | 30 |
| Sep 18, 2026 | 30 |
| Sep 17, 2026 | 30 |
| Sep 16, 2026 | 30 |
| Sep 15, 2026 | 30 |
| Sep 14, 2026 | 30 |
| Sep 13, 2026 | 30 |
| Sep 12, 2026 | 30 |
| Sep 11, 2026 | 30 |
| Sep 10, 2026 | 30 |
| Sep 9, 2026 | 30 |
| Sep 8, 2026 | 30 |
| Sep 7, 2026 | 30 |
| Sep 6, 2026 | 30 |
452−138 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 452 |
| Dec 4, 2026 | 376 |
| Dec 3, 2026 | 335 |
| Dec 2, 2026 | 295 |
| Dec 1, 2026 | 289 |
| Nov 30, 2026 | 281 |
| Nov 29, 2026 | 273 |
| Nov 28, 2026 | 322 |
| Nov 27, 2026 | 366 |
| Nov 26, 2026 | 427 |
| Nov 25, 2026 | 468 |
| Nov 24, 2026 | 473 |
| Nov 23, 2026 | 490 |
| Nov 22, 2026 | 529 |
| Nov 21, 2026 | 528 |
| Nov 20, 2026 | 519 |
| Nov 19, 2026 | 651 |
| Nov 18, 2026 | 700 |
| Nov 17, 2026 | 699 |
| Nov 16, 2026 | 698 |
| Nov 15, 2026 | 672 |
| Nov 14, 2026 | 707 |
| Nov 13, 2026 | 751 |
| Nov 12, 2026 | 612 |
| Nov 11, 2026 | 566 |
| Nov 10, 2026 | 614 |
| Nov 9, 2026 | 602 |
| Nov 8, 2026 | 611 |
| Nov 7, 2026 | 548 |
| Nov 6, 2026 | 450 |
| Nov 5, 2026 | 396 |
| Nov 4, 2026 | 379 |
| Nov 3, 2026 | 337 |
| Nov 2, 2026 | 334 |
| Nov 1, 2026 | 343 |
| Oct 31, 2026 | 376 |
| Oct 30, 2026 | 452 |
| Oct 29, 2026 | 395 |
| Oct 28, 2026 | 322 |
| Oct 27, 2026 | 333 |
| Oct 26, 2026 | 363 |
| Oct 25, 2026 | 367 |
| Oct 24, 2026 | 429 |
| Oct 23, 2026 | 332 |
| Oct 22, 2026 | 503 |
| Oct 21, 2026 | 590 |
| Oct 20, 2026 | 574 |
| Oct 19, 2026 | 590 |
| Oct 18, 2026 | 626 |
| Oct 17, 2026 | 518 |
| Oct 16, 2026 | 568 |
| Oct 15, 2026 | 470 |
| Oct 14, 2026 | 508 |
| Oct 13, 2026 | 539 |
| Oct 12, 2026 | 493 |
| Oct 11, 2026 | 456 |
| Oct 10, 2026 | 480 |
| Oct 9, 2026 | 501 |
| Oct 8, 2026 | 518 |
| Oct 7, 2026 | 576 |
| Oct 6, 2026 | 570 |
| Oct 5, 2026 | 564 |
| Oct 4, 2026 | 537 |
| Oct 3, 2026 | 540 |
| Oct 2, 2026 | 535 |
| Oct 1, 2026 | 504 |
| Sep 30, 2026 | 383 |
| Sep 29, 2026 | 364 |
| Sep 28, 2026 | 388 |
| Sep 27, 2026 | 441 |
| Sep 26, 2026 | 416 |
| Sep 25, 2026 | 457 |
| Sep 24, 2026 | 447 |
| Sep 23, 2026 | 455 |
| Sep 22, 2026 | 460 |
| Sep 21, 2026 | 453 |
| Sep 20, 2026 | 433 |
| Sep 19, 2026 | 446 |
| Sep 18, 2026 | 402 |
| Sep 17, 2026 | 382 |
| Sep 16, 2026 | 365 |
| Sep 15, 2026 | 369 |
| Sep 14, 2026 | 463 |
| Sep 13, 2026 | 436 |
| Sep 12, 2026 | 426 |
| Sep 11, 2026 | 451 |
| Sep 10, 2026 | 524 |
| Sep 9, 2026 | 609 |
| Sep 8, 2026 | 622 |
| Sep 7, 2026 | 563 |
| Sep 6, 2026 | 590 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1111197152-root)<a href="https://payloaddirectory.dev/plugins/1111197152-root"><img src="https://payloaddirectory.dev/badge/1111197152-root.svg" alt="Payload Directory"></a>README
A powerful command menu plugin for Payload CMS that enhances navigation and accessibility within the admin panel. Quickly search and navigate through collections, globals, and custom actions using keyboard shortcuts.

✨ Quick Search - Instantly search across all collections and globals
⌨️ Keyboard Shortcuts - Fully customizable keyboard shortcuts powered by react-hotkeys-hook
🔍 Collection Submenu - Search within collection documents by their title field
📄 Live Document Search - Show documents from your own search endpoint while typing, above or below the menu
🎨 Custom Icons - Use any Lucide icon for collections and globals
🎯 Custom Items - Add custom actions and menu groups
🔒 Access Control - The menu shows only what a user may open, and custom items can guard themselves
🌍 i18n Support - Built-in English and Ukrainian translations, easily add your own
🖥️ Cross-platform - Optimized shortcuts for both macOS and Windows/Linux
npm install @veiag/payload-cmdk
# or
yarn add @veiag/payload-cmdk
# or
pnpm add @veiag/payload-cmdk
The plugin works out of the box with minimal configuration:
import { payloadCmdk } from '@veiag/payload-cmdk'
import { buildConfig } from 'payload'
export default buildConfig({
// ... your config
plugins: [
payloadCmdk({
// Plugin works without any options!
}),
],
})
This will:
⌘K (Mac) / Ctrl+K (Windows/Linux) keyboard shortcutimport { payloadCmdk } from '@veiag/payload-cmdk'
import { buildConfig } from 'payload'
export default buildConfig({
plugins: [
payloadCmdk({
// Keyboard shortcut to open the menu
shortcut: ['meta+k', 'ctrl+k'], // Default
// Search button configuration
searchButton: {
position: 'actions', // 'actions' | 'nav'
},
// Backdrop blur effect
blurBg: true, // Default
// Collection submenu configuration
submenu: {
enabled: true, // Default
shortcut: 'shift+enter', // 'shift+enter' | 'enter'
icons: {
posts: 'FileText',
users: 'User',
},
},
// Custom icons for collections and globals
icons: {
collections: {
posts: 'FileText',
pages: 'File',
media: 'Image',
users: 'Users',
},
globals: {
settings: 'Settings',
navigation: 'Menu',
},
},
// Collections/globals to ignore
slugsToIgnore: ['payload-migrations', 'payload-preferences'],
// Custom menu items
customItems: [
{
type: 'group',
title: 'Quick Actions',
items: [
{
type: 'item',
slug: 'view-site',
label: 'View Site',
icon: 'ExternalLink',
action: {
type: 'link',
href: 'https://your-site.com',
},
},
{
type: 'item',
slug: 'clear-cache',
label: 'Clear Cache',
icon: 'Trash2',
action: {
type: 'api',
method: 'POST',
href: '/api/cache/clear',
},
},
],
},
],
// Disable the plugin
disabled: false, // Default
}),
],
})
shortcutKeyboard shortcut to open the command menu. Powered by react-hotkeys-hook.
string | string[]['meta+k', 'ctrl+k']The default provides cross-platform support:
meta+k - Works on macOS (⌘K)ctrl+k - Works on Windows/Linux (Ctrl+K)Examples:
// Single shortcut
shortcut: 'ctrl+shift+k'
// Multiple shortcuts for cross-platform support
shortcut: ['meta+k', 'ctrl+k']
// Custom combinations
shortcut: ['meta+/', 'ctrl+/']
searchButtonConfiguration for the search button displayed in the admin panel.
{ position?: 'actions' | 'nav' } | false{ position: 'actions' }Options:
position: 'actions' - Display in the action buttons area (default)position: 'nav' - Display in the navigation sidebarfalse - Hide the search button completely (keyboard shortcut still works)Examples:
// Display in navigation
searchButton: {
position: 'nav'
}
// Hide search button
searchButton: false
Actions button position:

Navigation button position:

blurBgEnable backdrop blur effect when the command menu is open.
booleantrueblurBg: false // Disable blur effect
submenuConfigure submenu behavior for searching within collection documents.
object{ enabled: true, shortcut: 'shift+enter' }Options:
| Property | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable/disable submenu functionality |
shortcut | 'shift+enter' | 'enter' | 'shift+enter' | Keyboard shortcut to open submenu |
icons | object | undefined | Custom icons for collection submenus |
Shortcut behavior:
shift+enter: Shift+Enter opens submenu, Enter navigates to collection listenter: Enter opens submenu, Shift+Enter navigates to collection list
Example:
submenu: {
enabled: true,
shortcut: 'enter',
icons: {
posts: 'FileText',
products: 'ShoppingCart',
}
}
The submenu searches documents by their useAsTitle field (or id if not specified). You can configure this in your collection:
{
slug: 'posts',
admin: {
useAsTitle: 'title' // Submenu will search by this field
}
}
documentSearchShow live documents from your own search endpoint on the main page while the user types, e.g. people by name, email or phone number across several collections. Off unless configured.
DocumentSearchConfigundefineddocumentSearch: {
endpoint: '/api/cmdk-search', // required
minLength: 2, // don't search shorter queries (default: 2)
debounceMs: 60, // wait after the last keystroke (default: 60)
position: 'after', // 'before' (default) or 'after' the menu entries
toggle: true, // footer checkbox to turn the results off (default: false)
}
The menu calls GET <endpoint>?q=<query> with the user's cookies and expects a DocumentSearchResponse:
type DocumentSearchResponse = {
query: string
groups: {
slug: string
title: string // group heading
icon: string // Lucide icon name
items: {
id: string // unique across all groups, e.g. 'posts:123'
label: string
href: string // where Enter takes the user
description?: string // second line, e.g. an email address
badge?: string // small tag on the right, e.g. 'Draft'
}[]
}[]
moreHref?: string // optional "Show all results" link, e.g. to a search page
}
It also calls the endpoint once with an empty q when the menu opens, to warm it up; answer that with no groups. The types are exported from @veiag/payload-cmdk.
A minimal endpoint that searches posts by title, with the user's own access:
import type { Endpoint } from 'payload'
import type { DocumentSearchResponse } from '@veiag/payload-cmdk'
export const cmdkSearch: Endpoint = {
path: '/cmdk-search',
method: 'get',
handler: async (req) => {
const query = typeof req.query?.q === 'string' ? req.query.q.trim() : ''
if (!req.user || query.length < 2) {
return Response.json({ query, groups: [] } satisfies DocumentSearchResponse)
}
const { docs } = await req.payload.find({
collection: 'posts',
where: { title: { like: query } },
limit: 5,
depth: 0,
overrideAccess: false,
req,
})
return Response.json({
query,
groups: docs.length
? [{
slug: 'posts',
title: 'Posts',
icon: 'Newspaper',
items: docs.map((doc) => ({
id: `posts:${doc.id}`,
label: doc.title,
href: `/admin/collections/posts/${doc.id}`,
})),
}]
: [],
} satisfies DocumentSearchResponse)
},
}
Register it in endpoints of your Payload config. Results are cached per query for 30 seconds in the browser, matching words are highlighted, and Cmd/Ctrl+Enter opens a result in a new tab.
With position: 'before' the results show above the menu entries. With position: 'after' the menu entries (collections, globals, custom items) keep the top places, which suits users who mostly navigate with the menu; a query that matches no menu entry still highlights the first result, so Enter opens it.
With toggle: true the footer gets a "Show documents" checkbox (translation key showDocuments). Unticked, the menu neither fetches nor shows results, so it only searches the menu. The choice is saved per user as the Payload preference payload-cmdk-document-search ({ enabled: boolean }), and results are on until the user unticks it.
iconsCustomize icons for collections and globals using Lucide icon names.
object{ collections: {}, globals: {} }Default icons:
Files iconGlobe iconExample:
icons: {
collections: {
posts: 'FileText',
pages: 'File',
media: 'Image',
users: 'Users',
categories: 'Folder',
},
globals: {
settings: 'Settings',
navigation: 'Menu',
footer: 'Layout',
}
}
Browse all available icons at lucide.dev/icons.
![]()
customItemsAdd custom menu items and groups to the command menu.
Array<CustomMenuItem | CustomMenuGroup>[]{
type: 'item',
slug: 'unique-slug', // Must be unique across all items
label: 'Item Label', // Can be a localized object — see Localization below
icon: 'LucideIconName', // Optional, from lucide.dev/icons
collectionSlugs: ['posts'], // Optional — only show on these collection pages
collectionContext: ['list'], // Optional — 'list', 'document', or both
access: ({ req }) => true, // Optional — server-side check, see Access Control below
action: { ... } // See Action Types below
}
Groups are rendered with a heading and can contain multiple items. Groups with identical titles are automatically merged.
{
type: 'group',
title: 'Group Title', // Can be a localized object
collectionSlugs: ['posts'], // Optional — only show on these collection pages
collectionContext: ['list'], // Optional
access: ({ req }) => true, // Optional — server-side check, see Access Control below
items: [
// Array of CustomMenuItem
]
}
The menu never offers a user something they cannot open.
Collections and globals are filtered the same way Payload filters its own navigation: a
collection appears only if the user passes its read access and it is not excluded by
admin.hidden. Nothing needs configuring for this.
Custom items and groups answer for themselves through an optional access function:
customItems: [
{
type: 'item',
slug: 'purge-cache',
label: 'Purge Cache',
access: ({ req }) => req.user?.role === 'admin',
action: { type: 'api', href: '/api/cache/purge', method: 'POST' },
},
]
The function receives the item itself and a req carrying the current user, so it can reach
the Local API:
access: async ({ req }) => {
const { totalDocs } = await req.payload.count({
collection: 'invoices',
where: { owner: { equals: req.user?.id } },
})
return totalDocs > 0
}
Three things are worth knowing:
Denial is the safe answer. If the function throws, the item is dropped.
A denied group takes its items with it, whatever their own access says. An allowed group still filters each item, and a group left with no items is dropped.
Every item requires an action that determines what happens when the item is selected.
link — Navigate to a URLNavigates to a URL. Supports both internal paths and external URLs.
action: {
type: 'link',
href: '/admin/collections/posts', // or 'https://your-site.com'
}
api — Call an API endpointMakes an HTTP request when the item is selected. The menu closes after the request completes (or fails).
action: {
type: 'api',
href: '/api/cache/clear',
method: 'POST', // 'GET' | 'POST' | 'PUT' | 'DELETE' — default: 'GET'
body: { scope: 'all' }, // Optional JSON body
}
function — Call a client-side handlerBecause the plugin config is serialized across the Next.js server→client boundary, a handler that runs in the browser cannot live directly in payload.config.ts. Instead, you reference a handler by a string key in the config and register the actual function on the client. (The access functions above are the exception: they never cross that boundary, because they run on the server.)
Step 1 — reference the key in your config:
// payload.config.ts
customItems: [
{
type: 'item',
slug: 'save-document',
label: 'Save Document',
icon: 'Save',
collectionContext: ['document'],
action: {
type: 'function',
key: 'save-current-doc', // Must match the key used in registerCommandMenuAction
},
},
]
Step 2 — register the handler in a client component:
// e.g. app/(payload)/layout.tsx or a custom admin component
'use client'
import { registerCommandMenuAction, unregisterCommandMenuAction } from '@veiag/payload-cmdk/client'
import { useEffect } from 'react'
export default function AdminLayout({ children }) {
useEffect(() => {
registerCommandMenuAction('save-current-doc', () => {
// Submit the currently active form (Payload's save button)
document.querySelector<HTMLButtonElement>('button[type="submit"]')?.click()
})
// Clean up when the component unmounts
return () => unregisterCommandMenuAction('save-current-doc')
}, [])
return <>{children}</>
}
The handler can be synchronous or return a Promise. The menu always closes after it resolves (or throws).
Full example with multiple function actions:
// payload.config.ts
customItems: [
{
type: 'group',
title: 'Document Actions',
collectionContext: ['document'],
items: [
{
type: 'item',
slug: 'save-document',
label: 'Save Document',
icon: 'Save',
action: { type: 'function', key: 'save-current-doc' },
},
{
type: 'item',
slug: 'copy-doc-link',
label: 'Copy Document Link',
icon: 'Link',
action: { type: 'function', key: 'copy-doc-link' },
},
],
},
{
type: 'item',
slug: 'import-posts',
label: 'Import Posts',
icon: 'Upload',
collectionSlugs: ['posts'],
collectionContext: ['list'],
action: { type: 'function', key: 'import-posts' },
},
]
// Client component / layout
'use client'
import { registerCommandMenuAction, unregisterCommandMenuAction } from '@veiag/payload-cmdk/client'
import { useEffect } from 'react'
export default function AdminLayout({ children }) {
useEffect(() => {
registerCommandMenuAction('save-current-doc', () => {
document.querySelector<HTMLButtonElement>('button[type="submit"]')?.click()
})
registerCommandMenuAction('copy-doc-link', () => {
navigator.clipboard.writeText(window.location.href)
})
registerCommandMenuAction('import-posts', async () => {
await fetch('/api/posts/import', { method: 'POST' })
})
return () => {
unregisterCommandMenuAction('save-current-doc')
unregisterCommandMenuAction('copy-doc-link')
unregisterCommandMenuAction('import-posts')
}
}, [])
return <>{children}</>
}
Note: If a key is used in the config but no handler has been registered, the plugin logs a warning to the console and the menu still closes normally.
collectionSlugs — Restrict to specific collectionsShow an item or group only when the user is viewing a particular collection.
{
type: 'item',
slug: 'export-posts',
label: 'Export Posts',
icon: 'Download',
collectionSlugs: ['posts'], // only visible on /admin/collections/posts/*
action: { type: 'function', key: 'export-posts' },
}
Omit collectionSlugs (or pass an empty array) to show the item on all pages, including non-collection pages.
collectionContext — Restrict to list or document pagesUse collectionContext on any item or group to control exactly where inside a collection it appears.
('document' | 'list')[]| Value | Where it appears |
|---|---|
'list' | Collection list page — e.g. /admin/collections/posts |
'document' | Document edit or create page — e.g. /admin/collections/posts/abc123 or /admin/collections/posts/create |
Pass both values, or omit the field entirely, to show the item on all collection pages.
collectionContext can be combined with collectionSlugs to target a specific collection and a specific page context, or used alone to apply to all collections.
Examples:
customItems: [
// Only on the posts list page
{
type: 'item',
slug: 'import-posts',
label: 'Import Posts',
icon: 'Upload',
collectionSlugs: ['posts'],
collectionContext: ['list'],
action: { type: 'function', key: 'import-posts' },
},
// Only when editing or creating a post
{
type: 'item',
slug: 'save-post',
label: 'Save Post',
icon: 'Save',
collectionSlugs: ['posts'],
collectionContext: ['document'],
action: { type: 'function', key: 'save-current-doc' },
},
// On any document edit/create page across all collections
{
type: 'item',
slug: 'copy-link',
label: 'Copy Document Link',
icon: 'Link',
collectionContext: ['document'],
action: { type: 'function', key: 'copy-doc-link' },
},
// On both list and document pages (same as omitting collectionContext)
{
type: 'item',
slug: 'help',
label: 'Open Help',
icon: 'HelpCircle',
collectionSlugs: ['posts'],
collectionContext: ['list', 'document'],
action: { type: 'link', href: '/docs' },
},
]
Example with localization:
customItems: [
{
type: 'group',
title: {
en: 'Quick Actions',
uk: 'Швидкі дії',
},
items: [
{
type: 'item',
slug: 'view-site',
label: {
en: 'View Site',
uk: 'Переглянути сайт',
},
icon: 'ExternalLink',
action: {
type: 'link',
href: 'https://your-site.com',
},
},
{
type: 'item',
slug: 'regenerate',
label: 'Regenerate Cache',
icon: 'RefreshCw',
action: {
type: 'api',
method: 'POST',
href: '/api/cache/regenerate',
},
},
],
},
]
slugsToIgnoreSpecify which collection/global slugs to exclude from the command menu.
CollectionSlug[] | { ignoreList: CollectionSlug[], replaceDefaults?: boolean }['payload-migrations', 'payload-preferences', 'payload-locked-documents']Examples:
// Add to default ignore list
slugsToIgnore: ['internal-collection', 'test-data']
// Replace default ignore list completely
slugsToIgnore: {
ignoreList: ['my-hidden-collection'],
replaceDefaults: true
}
disabledCompletely disable the plugin.
booleanfalsedisabled: process.env.DISABLE_COMMAND_MENU === 'true'
registerCommandMenuFilter)By default the menu uses cmdk's fuzzy filter. To match differently (for example without diacritics, or only on whole words), register your own filter on the client:
'use client'
import { registerCommandMenuFilter } from '@veiag/payload-cmdk/client'
const normalize = (text: string) =>
text.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase()
registerCommandMenuFilter((value, search, keywords = []) => {
const query = normalize(search)
const candidates = [value, ...keywords].map(normalize)
if (candidates.some((c) => c === query)) return 1
if (candidates.some((c) => c.startsWith(query))) return 0.8
if (candidates.some((c) => c.includes(query))) return 0.5
return 0
})
value is the entry's slug.keywords is [group title, label] for an entry in a group, [label] otherwise.0 to hide the entry. A higher score puts the entry, and its group, higher up.registerCommandMenuFilter(undefined) to go back to the default filter.Whichever filter is active, groups are ordered by their best-matching entry while you type, so an exact match in a later group shows above a weak match in an earlier one.
The plugin includes built-in translations for:
en)uk)You can add translations for other languages using Payload's i18n configuration:
import { buildConfig } from 'payload'
export default buildConfig({
i18n: {
supportedLanguages: {
//You can learn more about adding languages in the Payload docs
en,
uk,
de,
fr,
},
translations: {
de: {
cmdkPlugin: {
loading: 'Lädt...',
navigate: 'zum Navigieren',
noResults: 'Keine Ergebnisse gefunden',
open: 'zum Öffnen',
search: 'Sammlungen, Globals durchsuchen...',
searchIn: 'Suchen in {{label}}',
searchInCollection: 'in Sammlung suchen',
searchShort: 'Suchen',
},
},
fr: {
cmdkPlugin: {
loading: 'Chargement...',
navigate: 'pour naviguer',
noResults: 'Aucun résultat trouvé',
open: 'pour ouvrir',
search: 'Rechercher collections, globals...',
searchIn: 'Rechercher dans {{label}}',
searchInCollection: 'pour rechercher dans la collection',
searchShort: 'Rechercher',
},
},
},
},
plugins: [
payloadCmdk({
// Your config
}),
],
})
All translation keys are under the cmdkPlugin namespace:
| Key | Description | Example (EN) |
|---|---|---|
search | Main search placeholder | "Search collections, globals..." |
searchShort | Short search label | "Search" |
searchIn | Submenu search placeholder | "Search in {{label}}" |
loading | Loading state | "Loading..." |
noResults | No results state | "No results found" |
navigate | Footer hint for navigation | "to navigate" |
searchInCollection | Footer hint for collection search | "to search in collection" |
open | Footer hint for opening documents | "to open" |
openInNewTab | Footer hint for documentSearch results | "to open in a new tab" |
showAllResults | documentSearch link to all results | "Show all results for “{{query}}”" |
showDocuments | documentSearch.toggle checkbox label | "Show documents" |
| Shortcut | Action |
|---|---|
⌘K / Ctrl+K | Open/close command menu |
Esc | Close menu or go back in submenu |
↑ ↓ | Navigate items |
Enter | Select item or navigate to collection |
Shift+Enter | Search within collection (default) |
⌘Enter / Ctrl+Enter | Open the selected documentSearch result in a new tab |
| Shortcut | Action |
|---|---|
Esc | Go back to main menu |
Enter | Open selected document |
export default buildConfig({
plugins: [payloadCmdk()],
})
export default buildConfig({
plugins: [
payloadCmdk({
shortcut: ['meta+/', 'ctrl+/'],
searchButton: false, // Hide button, only use keyboard
}),
],
})
export default buildConfig({
plugins: [
payloadCmdk({
customItems: [
{
type: 'item',
slug: 'documentation',
label: 'View Documentation',
icon: 'BookOpen',
action: {
type: 'link',
href: 'https://docs.your-site.com',
},
},
],
}),
],
})
export default buildConfig({
plugins: [
payloadCmdk({
icons: {
collections: {
posts: 'Newspaper',
pages: 'FileText',
media: 'Image',
categories: 'FolderTree',
tags: 'Tag',
users: 'UserCircle',
comments: 'MessageCircle',
},
globals: {
header: 'LayoutTemplate',
footer: 'Layout',
settings: 'Settings',
navigation: 'Menu',
seo: 'Search',
},
},
submenu: {
enabled: true,
icons: {
posts: 'FileText',
pages: 'File',
media: 'Image',
},
},
}),
],
})
Objects are not valid as a React child error: Ensure your admin.useAsTitle field is a string and not an object. Currently, plugin doesn't have any safeguards for non-string title fields.Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Found a bug or have a feature request? Please open an issue on GitHub.
MIT © VeiaG
payload enhanced sidebar
Tabbed sidebar navigation for the Payload admin that groups collections, globals and custom links
76835/wk32v3 v4
payload nav studio
Replaces the Payload admin sidebar with a drag and drop navigation that each user can customize
66108/wk15v3
payload plugin menu
Editor-friendly navigation menus with dropdowns, headings, icons and per-entry visibility
76126/wk0v3
payload theme
shadcn-style redesign of the Payload admin with dashboard, command palette, dark mode and live theme customizer
751.8k/wk36v3
theme
Admin UI theme for Payload v4 with three styles and four palettes in light and dark
74343/wk10v4
Payload Advanced Sidebar
Add icons, custom links and animated groups to the Payload admin sidebar
7042/wk7v3