By default, hotkey strings type-check against US QWERTY keys, so injectHotkey('Mod+Ö', () => this.toggleComment()) triggers a TypeScript error. At runtime, it already works when a German user presses Ctrl+Ö or Cmd+Ö.
Registering extra keyboard layout sets tells TypeScript to accept those characters too. It changes types only, adds zero runtime code to your bundle, and doesn't alter how keys match.
Most apps never need to register extra layouts. A to Z, 0 to 9, and common US punctuation already match across international layouts automatically:
Register layout sets only when you intentionally target keys unique to specific layouts, such as a single-key ß shortcut or shortcuts labeled with Ö in a localized UI.
Augment Register with keys, a union of the layout types your app supports. Each set is a type exported from @tanstack/angular-hotkeys:
import type { GermanKeys, UsKeys } from '@tanstack/angular-hotkeys'
declare module '@tanstack/angular-hotkeys' {
interface Register {
keys: UsKeys | GermanKeys
}
}Place this declaration in any file of your TypeScript project, such as main.ts, where you bootstrap your app. If you also register app hotkeys, add keys to the same Register interface, or declare it in another file. TypeScript merges the two.
German keys now type-check wherever a hotkey goes:
injectHotkey('Mod+Ö', () => this.toggleComment())
injectHotkey('ß', () => this.toggleSidebar())
injectHotkey('Mod+[', () => this.outdent()) // Still accepted, because UsKeys is listed
injectHotkey('Mod+Ñ', () => this.search()) // Type error: Spanish isn't registeredinjectHotkeys, injectHotkeyHint, injectFormatForDisplay, app hotkeys, custom hotkeys, and the Hotkey and HotkeyChord types all follow the registration.
26 exported sets cover 33 layouts. Identical layouts share aliases, such as AustrianKeys and GermanKeys. Each set includes characters typed unshifted or with Shift across Windows, macOS, and Linux, excluding dead keys and AltGr or Option characters:
| Set | Layouts |
|---|---|
| UsKeys | US QWERTY (default) |
| UkKeys | UK (British) |
| GermanKeys, AustrianKeys | German and Austrian QWERTZ |
| SwissGermanKeys, SwissFrenchKeys | Swiss German and Swiss French |
| FrenchKeys, BelgianKeys | French and Belgian AZERTY |
| CanadianFrenchKeys | Canadian French |
| SpanishKeys, LatinAmericanKeys | Spanish (Spain) and Latin American |
| PortugueseKeys, BrazilianKeys | Portuguese (Portugal) and Brazilian ABNT2 |
| ItalianKeys | Italian |
| DanishKeys, NorwegianKeys | Danish and Norwegian |
| SwedishKeys, FinnishKeys | Swedish and Finnish |
| IcelandicKeys | Icelandic |
| CzechKeys, SlovakKeys, HungarianKeys | Czech, Slovak, and Hungarian QWERTZ |
| CroatianKeys, SlovenianKeys, SerbianLatinKeys | Croatian, Slovenian, and Serbian (Latin) |
| EstonianKeys, LithuanianKeys | Estonian and Lithuanian |
| TurkishKeys | Turkish Q |
| RomanianKeys | Romanian (standard) |
| GreekKeys, RussianKeys, UkrainianKeys, BulgarianKeys, HebrewKeys | Greek, Russian, Ukrainian, Bulgarian (BDS), and Hebrew |
Polish and Latvian share US QWERTY base keys without AltGr, and most Dutch users use US International, so they don't need separate sets.
The Keyboard Layouts example registers German keys and shows which hotkeys fire on a German keyboard.