Skip to content

Commit f6387b7

Browse files
antfuclaude
andcommitted
feat: support showInPalette 'without-children' value
Allow showInPalette to accept 'without-children' alongside boolean. When set, the command appears in the palette but its children are not flattened into top-level search results — they remain accessible only via drill-down when the parent is selected. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9b73fd7 commit f6387b7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

docs/kit/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const plugin: Plugin = {
6969
| `description` | `string` | Optional description text |
7070
| `icon` | `string` | Iconify icon string (e.g. `ph:trash-duotone`) |
7171
| `category` | `string` | Category for grouping |
72-
| `showInPalette` | `boolean` | Whether to show in command palette (default: `true`) |
72+
| `showInPalette` | `boolean \| 'without-children'` | Whether to show in command palette (default: `true`). `'without-children'` shows the command but doesn't flatten children into search — they're only accessible via drill-down. |
7373
| `when` | `string` | Conditional visibility expression (see [When Clauses](/kit/when-clauses)) |
7474
| `keybindings` | `DevToolsCommandKeybinding[]` | Default keyboard shortcuts |
7575
| `handler` | `Function` | Server-side handler. Optional if the command is a group for children. |

packages/core/src/client/webcomponents/components/command-palette/CommandPalette.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const flattenedItems = computed<FlatItem[]>(() => {
3535
const result: FlatItem[] = []
3636
for (const cmd of commandsCtx.value.paletteCommands) {
3737
result.push({ entry: cmd, searchTitle: cmd.title })
38-
if (cmd.children) {
38+
if (cmd.children && cmd.showInPalette !== 'without-children') {
3939
for (const child of cmd.children) {
4040
if (child.showInPalette === false)
4141
continue

packages/kit/src/types/commands.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ export interface DevToolsCommandBase {
3333
category?: string
3434
/**
3535
* Whether to show in command palette. Default: true
36+
*
37+
* - `true` — show the command and flatten its children into search results
38+
* - `false` — hide the command entirely from the palette
39+
* - `'without-children'` — show the command but don't flatten children into top-level search (children are still accessible via drill-down)
3640
*/
37-
showInPalette?: boolean
41+
showInPalette?: boolean | 'without-children'
3842
/**
3943
* Optional context expression for conditional visibility.
4044
* When set, the command is only shown in the palette and only executable

0 commit comments

Comments
 (0)