Skip to content
Cynco UI

Components · Actions

ShortcutButton

A primary or secondary Button that shows and binds a keyboard shortcut.

import { ShortcutButton } from "@cynco-labs/ui";

Example

Use

Sheet and dialog submit actions (metaShortcut="enter" → ⌘/Ctrl ↵) and page-level "new" actions (singleShortcut="n").

Props

children, metaShortcut or singleShortcut, variant (primary · secondary), onClick, isLoading.

Notes

The shortcut is registered while mounted; the keycap renders inside the button. A bare-letter singleShortcut never fires while typing in a field and follows the user's single-key shortcuts switch (WCAG 2.1.4, useCharacterKeyShortcuts, set in ShortcutsDialog): when it is off the key stops firing and the keycap and aria-keyshortcuts are dropped. ⌘/Ctrl chords and named keys like Escape always work. The shortcut triggers a real click, so onClick and form submit behave exactly as a mouse click.

Source Demo source Markdown