Docs
CodeRabbit
Cloudflare
Railway
Netlify
SerpAPI
WorkOS
OpenRouter
AG Grid
Clerk
Electric
Unkey
Prisma
Sentry
CodeRabbit
Cloudflare
Railway
Netlify
SerpAPI
WorkOS
OpenRouter
AG Grid
Clerk
Electric
Unkey
Prisma
Sentry
Hotkeys API Reference
Hotkey Sequence API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Hotkey Sequence Recorder API Reference
Normalization & format API Reference
Key hold & held keys API Reference

injectHeldKeyCodes

Function: injectHeldKeyCodes()

ts
function injectHeldKeyCodes(): Signal<Record<string, string>>;
function injectHeldKeyCodes(): Signal<Record<string, string>>;

Defined in: injectHeldKeyCodes.ts:28

Angular inject-based API that returns a signal of a map from held key names to their physical event.code values.

Useful for debugging which physical key was pressed (e.g. distinguishing left vs right Shift via "ShiftLeft" / "ShiftRight").

Returns

Signal<Record<string, string>>

Signal of record mapping normalized key names to their event.code values

Example

ts
@Component({
  template: `
    @for (key of heldKeys(); track key) {
      <kbd>{{ key }} <small>{{ heldCodes()[key] }}</small></kbd>
    }
  `,
})
export class KeyDebugComponent {
  heldKeys = injectHeldKeys()
  heldCodes = injectHeldKeyCodes()
}
@Component({
  template: `
    @for (key of heldKeys(); track key) {
      <kbd>{{ key }} <small>{{ heldCodes()[key] }}</small></kbd>
    }
  `,
})
export class KeyDebugComponent {
  heldKeys = injectHeldKeys()
  heldCodes = injectHeldKeyCodes()
}