Skip to content

Shortcuts Panel 快捷键面板 ​

快捷键速查面板:264px 的浮起面板,带标题栏与关闭按钮,下方是带小标题的标签 + 键位芯片行;内容过长时在体内滚动。

示例 ​

三个分组 ​

moonbit
@sumi.shortcuts_panel(
  sections=[
    @sumi.ShortcutSection::new("General", [
      @sumi.ShortcutItem::new("Toggle sidebar", "Cmd /"),
      @sumi.ShortcutItem::new("Send message", "Enter"),
    ]),
    @sumi.ShortcutSection::new("Editing", [
      @sumi.ShortcutItem::new("Select all", "⌘ A"),
      @sumi.ShortcutItem::new("Undo", "⌘ Z"),
    ]),
  ],
  on_close=close_panel,
)

API ​

shortcuts_panel ​

名称类型默认值说明
sections *Array[ShortcutSection]—带标题的快捷键分组
titleString"Shortcuts"标题栏文字(默认 "Shortcuts")
on_closeCmd—关闭按钮命令
widthInt264面板宽度 px(默认 264)
max_heightInt660面板最大高度 px(默认 660)
idString—元素 id
classString—附加 class 名
attrsAttrs—附加 HTML 属性
styleArray[String][]附加内联样式

ShortcutSection::new ​

一个带标题的分组。

名称类型默认值说明
titleString—原生 tooltip 标题
itemsArray[ShortcutItem]—

ShortcutItem::new ​

一行。

名称类型默认值说明
labelString—
keysString—

* 必填(标签)参数——其余均为可选。