[ @sdxc/ui/mixins ]
hotkey
Global keyboard-shortcut mixin for a Command dialog or any dialog/popover host.
import { hotkey } from "@sdxc/ui/mixins";Usage
Opens the host when combo is struck anywhere in the document while it's
closed, and closes it again on the same combo while it's already open,
driving the host's own native <dialog> or [popover] open state.
Signature
hotkey(combo: string): MixinDescriptor<HTMLElement>Parameters
| Parameter | Type | Description |
|---|---|---|
combo | string | Key combination that opens or closes the host, e.g. "mod+k". |
Examples
<dialog id="command-palette" mix={[hotkey("mod+k")]}>
<Command>...</Command>
</dialog><div id="quick-switcher" popover="manual" mix={[hotkey("mod+shift+k")]}>
...
</div>