Skip to content

ShortcutsModal ​

ShortcutsModal is the list of keyboard shortcuts, in a modal.

When to use ​

Use it to open the list of keyboard shortcuts from a menu or a button, with the same shortcuts the application attaches. A Shell already opens it with the help key and lists its shortcuts.

Props ​

PropDefaultDescription
openfalseWhether it is open (bindable)
shortcutsrequiredThe shortcuts, { key, label, group? }[] (below)
titlekeyboardShortcuts messageThe title of the modal
macthe platformtrue writes the keys as a Mac does
groupsThe order of the groups; the others follow as they first appear
oncloseCalled when it closes
inlinefalseThe same surface in the flow, for documentation

key is written as a Shell's shortcut is (mod+z), and label says what the shortcut does. display lists other keys in its place, each written as key is and joined with " / "; a hidden shortcut is not listed. A whole Shortcut can be passed; run, when and aliases are not read.

Contract ​

A Modal of the md width, flush, since its rows hold their own padding. The shortcuts without a group come first, as one List without a heading; then each group is a SectionHeader with flush content and the group as its name, in the order of groups and then in the order the groups first appear. Each shortcut is a ListItem that is only read, with a line under it: the label on the left, clipped to one line, and the key on the right as a bare Kbd, written as the platform writes it (⇧⌘Z on a Mac, Ctrl+Shift+Z elsewhere; digit as 0–9).

Example ​

ShortcutsModal

Released under the Apache-2.0 license.