SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

hotkey

Global keyboard-shortcut mixin for a Command dialog or any dialog/popover host.

tsx
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

typescript
hotkey(combo: string): MixinDescriptor<HTMLElement>

Parameters

ParameterTypeDefaultRequiredDescription
combostring—YesKey combination that opens or closes the host, e.g. "mod+k", where mod is Command on Apple keyboards and Control elsewhere.

Examples

tsx
<dialog id="command-palette" mix={[hotkey("mod+k")]}>
	<Command>...</Command>
</dialog>
tsx
<div id="quick-switcher" popover="manual" mix={[hotkey("mod+shift+k")]}>
	...
</div>
@sdxc/ui

Can’t find it? Contact us