Shortcuts Dialog
A ? dialog that lists the shortcuts available where the person is, grouped by ShortcutScope.
Example
Press Keyboard shortcuts, or focus a button and press ?, to list what you can do here.
shortcuts-dialog-demo.tsxCopy code
Installation
Copy code
Usage
ImportCopy code
API reference
ShortcutsDialog
| Prop | Type | Default |
|---|---|---|
shortcutThe key that opens it; `null` registers none, for a dialog you open with `open`. | string | null | "?" |
open | boolean | – |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | – |
labels | Partial<ShortcutsDialogLabels> | – |
extraExtra rows that aren't registered shortcuts, like a list's own keys. | readonly ListedShortcut[] | noExtra |
className | string | – |
childrenA `ShortcutsDialogTrigger`, the way in without a keyboard. | ReactNode | – |
ShortcutsDialogTrigger
Takes DialogTrigger.
Other exports
shortcutsDialogLabelstype ShortcutsDialogLabelstype ShortcutsDialogPropsAccessibility
- A modal dialog titled by its heading; each scope is a labelled section of key and description pairs.
- ? opens it on any keyboard layout: a symbol shortcut matches the character typed, whether it took Shift, AltGr or Option.
- ShortcutsDialogTrigger is the way in on touch screens, where there is no ? key; it takes focus as it opens, so its scope's shortcuts are listed in Safari too.
Agent actions
Agents open it by pressing the ShortcutsDialogTrigger by name; the shortcuts themselves add nothing for agents, who press the same buttons.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.