Tally UI

ShortcutHelpSheet

A dialog that lists the keyboard shortcuts of the screen and runs an action when its row is pressed.

Import

import { ShortcutHelpSheet } from '@tallyui/components';

Usage

Mount <ShortcutHelpSheet /> inside the screen's ShortcutProvider, beside the Catalogue and Cart. It registers the shortcuts.help action, so Alt+/ opens it.

<ShortcutProvider enabled={isFocused}>
  <Catalogue />
  <Cart />
  <ShortcutHelpSheet />
</ShortcutProvider>

Props

PropTypeDescription
openbooleanControls whether the sheet is open; omit for internal state.
onOpenChange(open: boolean) => voidCalled when the sheet requests a change in visibility.
titlestringDialog heading. Defaults to Keyboard shortcuts.
macbooleanUse Mac modifier symbols. Defaults to platform detection.
testIDstringDialog test ID and row ID prefix. Defaults to shortcut-help-sheet.

Behaviour

  • The shortcuts.help chord, Alt+/ by default, opens the sheet.
  • Mount the sheet closed. A sheet mounted already open captures the listing before other components register, so every row shows as unavailable.
  • The rows show the actions that were available when it opened, because the open sheet blocks every chord.
  • Unbound actions are left out.
  • Unavailable rows, and the help row itself, are disabled.
  • Pressing a row closes the sheet, then runs that action.
  • When open is controlled, the parent must close the sheet in the same update as the row press; otherwise the row's action is dropped.
  • A row's action does not run while another overlay holds a useShortcutBlock.
  • A row's action does not run while the provider's enabled is false.
  • The keycaps show ⌥ on a Mac and Alt elsewhere.

Web and native

Native renders nothing and registers nothing.