# hotkeyDirective

<!-- DO NOT EDIT: this page is autogenerated from the type comments -->

```ts
function hotkeyDirective(alpine): void;
```

Defined in: [hotkeyDirective.ts:46](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/hotkeyDirective.ts#L46)

Installs `x-hotkey`, which registers the hotkey named by its modifiers while
its element exists: `x-hotkey.mod.s="save()"`, `x-hotkey.escape="close()"`,
`x-hotkey.g.h="goHome()"`. The expression gets `$event`. Alpine removes the
hotkey with its element, and when a morph changes or removes the attribute.

## Parameters

### alpine

`Alpine`

## Returns

`void`
