“the quick launcher in the middle of the screen”「屏幕中间的快速启动器」
“the keyboard popup for jumping anywhere”「用键盘想去哪就去哪的弹窗」
“the vscode style command search”「VS Code 那种命令搜索」
“the cmd k popup”「⌘K 弹窗」
ESC
Suggestions
No matching commands
标本可交互,可以直接操作。
Anatomy — every part, named解剖 —— 每个部件的名字
1Command input命令输入框CommandInput
“The search field at the top of the ⌘K menu” is the command input.
「⌘K 菜单顶部的搜索框」就是命令输入框。
Prompt fragmentPrompt 片段
the shadcn/ui CommandInput at the top of the command palette, filtering commands as the user types
命令面板顶部的 shadcn/ui CommandInput,随用户输入过滤命令
2Command group命令分组CommandGroup
“The labeled section grouping similar actions” is a command group.
「把同类操作归在一起、带小标题的分区」就是命令分组。
Prompt fragmentPrompt 片段
a shadcn/ui CommandGroup with a quiet heading above a related set of command items
一个 shadcn/ui CommandGroup,低调的小标题下面是一组相关命令项
3Active command活动命令CommandItem
“The result with the highlight that Enter will run” is the active command.
「高亮显示、按 Enter 就会执行的那条结果」就是活动命令。
Prompt fragmentPrompt 片段
the active shadcn/ui CommandItem with a full-row selection highlight showing what Enter will execute
活动的 shadcn/ui CommandItem,整行选中高亮,表明 Enter 将执行什么
4Command shortcut命令快捷键CommandShortcut
“The ⌘ letters aligned on the right of an action” are the command shortcut.
「操作项右边对齐的那几个 ⌘ 字母」就是命令快捷键。
Prompt fragmentPrompt 片段
the shadcn/ui CommandShortcut aligned at the trailing edge of its command item
shadcn/ui CommandShortcut,对齐在命令项的末尾边缘
Prompt — paste into your agentPrompt —— 直接粘贴给你的代理
Add a Command Palette using the shadcn/ui Command component inside a role="dialog", opened by ⌘K or Ctrl+K. Filter actions as the user types, support arrow-key selection and Enter, and restore focus to the invoking control on dismissal.
Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时
Debug my command palette (cmdk, Dialog + Command). Rule out: the cmd/ctrl-K listener attached to the wrong scope or eaten by the browser; the filter state persisting from the previous open — reset on open; focus escaping the dialog because the trap ignores portaled content; keydown firing during IME composition (check isComposing); the palette rendered under a higher stacking context. The symptom:
# Command Palette · 命令面板 Command Palette
UI reference — https://K3tty5555.github.io/LearnUI_PM/web/command-palette/
**A keyboard-first searchable launcher for actions and navigation**
键盘优先的可搜索启动器,用来执行操作和跳转导航
**Also called / 也叫:** command menu, quick actions, launcher, command bar / 命令菜单、快捷操作、启动器、命令栏
## Anatomy — every part, named / 解剖
1. **Command input · 命令输入框** (`CommandInput`)
“The search field at the top of the ⌘K menu” is the command input.
「⌘K 菜单顶部的搜索框」就是命令输入框。
Prompt fragment: the shadcn/ui CommandInput at the top of the command palette, filtering commands as the user types
2. **Command group · 命令分组** (`CommandGroup`)
“The labeled section grouping similar actions” is a command group.
「把同类操作归在一起、带小标题的分区」就是命令分组。
Prompt fragment: a shadcn/ui CommandGroup with a quiet heading above a related set of command items
3. **Active command · 活动命令** (`CommandItem`)
“The result with the highlight that Enter will run” is the active command.
「高亮显示、按 Enter 就会执行的那条结果」就是活动命令。
Prompt fragment: the active shadcn/ui CommandItem with a full-row selection highlight showing what Enter will execute
4. **Command shortcut · 命令快捷键** (`CommandShortcut`)
“The ⌘ letters aligned on the right of an action” are the command shortcut.
「操作项右边对齐的那几个 ⌘ 字母」就是命令快捷键。
Prompt fragment: the shadcn/ui CommandShortcut aligned at the trailing edge of its command item
## Prompt / 提示词
Add a Command Palette using the shadcn/ui Command component inside a role="dialog", opened by ⌘K or Ctrl+K. Filter actions as the user types, support arrow-key selection and Enter, and restore focus to the invoking control on dismissal.
用 shadcn/ui 的 Command 组件加一个命令面板,放在 role="dialog" 里,用 ⌘K 或 Ctrl+K 打开。随用户输入过滤操作,支持方向键选择和 Enter 执行,关闭后把焦点还给触发它的控件。
## Debug prompt / 调试提示词
Debug my command palette (cmdk, Dialog + Command). Rule out: the cmd/ctrl-K listener attached to the wrong scope or eaten by the browser; the filter state persisting from the previous open — reset on open; focus escaping the dialog because the trap ignores portaled content; keydown firing during IME composition (check isComposing); the palette rendered under a higher stacking context. The symptom:
调试我的命令面板(cmdk、Dialog + Command)。排查:⌘/Ctrl+K 监听器挂错了作用域,或被浏览器吃掉;上次打开时的过滤状态还留着——打开时要重置;焦点逃出 dialog,因为焦点陷阱忽略了 portal 渲染的内容;IME 输入法组词期间触发了 keydown(检查 isComposing);面板被更高的层叠上下文压在下面。症状:
## In code / 代码里叫什么
- **shadcn/ui** `Command`
- **ARIA** `role="dialog"`
- **ARIA** `role="combobox"`
- **Radix** `Dialog`