Skip to content

CommandPalette 命令面板

CommandPalette 提供了一个全局的指令中心,支持搜索、快捷键绑定以及指令分类。它是提升系统交互体验的重要工具。

基础用法

通过 isOpen 控制显示,并提供 commands 列表。

SXO Framework Switcher
🚧
This example is not yet available for .

快捷键

组件内置了全局键盘监听逻辑。如果指令配置了 shortcut,在页面上按下 Ctrl + [Shortcut]Cmd + [Shortcut] 将直接触发对应的 action

属性

参数说明类型默认值
isOpen是否显示面板booleanfalse
commands指令列表Command[][]

Command 接口定义

属性说明类型
id唯一标识符string
title指令标题string
description指令描述(可选)string
shortcut快捷键字符(可选,如 'S')string
action触发时的回调函数() => void
category指令分类(用于搜索过滤)string