# validateHotkey

```ts
function validateHotkey(hotkey): ValidationResult;
```

Defined in: [validate.ts:39](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/validate.ts#L39)

Validates a hotkey and returns any warnings or errors.
Each issue has a `reason` code, so apps can write their own messages.
Issues in a sequence carry the index of their `step`.

Checks for:
- Valid syntax (modifier+...+key format)
- Known modifiers
- A key that isn't a modifier
- Known keys

## Parameters

### hotkey

[`ValidatableHotkey`](../type-aliases/ValidatableHotkey.md)

The hotkey string to validate

## Returns

[`ValidationResult`](../interfaces/ValidationResult.md)

A ValidationResult with validity status, warnings, and errors

## Example

```ts
validateHotkey('Mod+S')
// { valid: true, warnings: [], errors: [] }

validateHotkey('')
// { valid: false, warnings: [], errors: [{ reason: 'empty' }] }

validateHotkey(['G', 'Foo+H'])
// { valid: false, warnings: [], errors: [{ reason: 'unknown-modifier', part: 'Foo', step: 1 }] }
```
