# hotkey

> Global keyboard-shortcut mixin for a Command dialog or any dialog/popover host: opens the host when a key combination strikes anywhere in the document, and closes it again on the same combination while it's already open, adapting to whichever native open API the host exposes.

```ts
import { hotkey } from "@sdxc/ui/mixins";
```

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

```ts
hotkey(combo: string): MixinDescriptor<HTMLElement>
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `combo` | `string` | Key combination that opens or closes the host, e.g. `"mod+k"`. |

## 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>
```
