# useHotkey

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

```ts
function useHotkey<T>(
   hotkey, 
   callback, 
   options?
): void;
```

Defined in: [useHotkey.ts:56](https://github.com/TanStack/hotkeys/blob/main/packages/octane-hotkeys/src/useHotkey.ts#L56)

Registers one hotkey: a chord such as `'Mod+S'`, a sequence such as
`['G', 'G']`, or an app hotkey from `defineAppHotkeys`. The callback and
options are refreshed after every commit. `undefined`, `null`, or `''`
registers nothing, for an optional shortcut.

## Type Parameters

### T

`T` *extends* `AdapterHotkeyInput`

## Parameters

### hotkey

`IfTypeParameter`\<`T`, `AdapterWrapperHotkey`, `KnownHotkey`\<`T`, `T` \| `null` \| `undefined`\>\>

### callback

`HotkeyCallback`\<`IfTypeParameter`\<`T`, `HotkeyCallbackContext`, `AdapterCallbackContextFor`\<`T`\>\>\>

### options?

`IfTypeParameter`\<`T`, [`UseHotkeyOptions`](../type-aliases/UseHotkeyOptions.md), \[`T`\] *extends* \[`AppHotkey`\<`string`, `AppHotkeyBinding`\>\] ? `AdapterAppHotkeyOptions`\<`Extract`\<`T`, `AppHotkey`\<`string`, `AppHotkeyBinding`\>\>, [`UseHotkeyTarget`](../type-aliases/UseHotkeyTarget.md)\> : `AdapterOptionsFor`\<`T`, [`UseHotkeyTarget`](../type-aliases/UseHotkeyTarget.md)\>\>

## Returns

`void`
