Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
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

injectHeldKeys

Function: injectHeldKeys()

ts
function injectHeldKeys(): Signal<string[]>;

Defined in: injectHeldKeys.ts:23

Angular inject-based API that returns a signal of currently held keyboard keys.

Subscribes to the global KeyStateTracker and updates whenever keys are pressed or released.

Returns

Signal<string[]>

Signal of array of currently held key names

Example

ts
@Component({
  template: `<div>Currently pressed: {{ heldKeys().join(' + ') || 'None' }}</div>`,
})
export class KeyDisplayComponent {
  heldKeys = injectHeldKeys()
}