Skip to content
Eskais UI

Foundations

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.

Installation

npx shadcn@latest add @eskais/shortcuts-dialog
Brings alongkbddialogshortcuts

Usage

Import
import { ShortcutsDialog, ShortcutsDialogTrigger, shortcutsDialogLabels } from "@/components/ui/shortcuts-dialog"

API reference

ShortcutsDialog

PropTypeDefault
shortcutThe key that opens it; `null` registers none, for a dialog you open with `open`.string | null"?"
openboolean–
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void–
labelsPartial<ShortcutsDialogLabels>–
extraExtra rows that aren't registered shortcuts, like a list's own keys.readonly ListedShortcut[]noExtra
classNamestring–
childrenA `ShortcutsDialogTrigger`, the way in without a keyboard.ReactNode–

ShortcutsDialogTrigger

Takes DialogTrigger.

Other exports

shortcutsDialogLabelstype ShortcutsDialogLabelstype ShortcutsDialogProps

Accessibility

  • 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.