@phalgunv/ngx-keyboard-shortcuts
v21.0.1
Published
Keyboard-shortcuts for creating and implementing keyboard events in Angular apps.
Downloads
6,847
Maintainers
Readme
@phalgunv/ngx-keyboard-shortcuts
⚠️ Maintained Fork: This is an actively maintained fork of the original
ngx-keyboard-shortcutspackage (now archived). This fork adds Angular 16+, 17+, 18+, 19+, 20+, and 21+ support with modern tooling.
By using simple directives ngx-keyboard-shortcuts allows you to create and implement custom keybindings events in your Angular applications.
Versioning
This package follows Angular's major version numbering:
- v16.x.x - Compatible with Angular 16+
- v17.x.x - Compatible with Angular 17+
- v18.x.x - Compatible with Angular 18+
- v19.x.x - Compatible with Angular 19+
- v20.x.x - Compatible with Angular 20+
- v21.x.x - Compatible with Angular 21+
This makes it easy to identify which version supports your Angular version.
Requirements
- Angular: 21+ (for v21.x), 20+ (for v20.x), 19+ (for v19.x), 18+ (for v18.x), 17+ (for v17.x), 16+ (for v16.x)
- Node.js: 20.0+
- TypeScript: 5.6.x (for v21.x, v20.x, and v19.x), 5.5.x (for v18.x), 5.4.x (for v17.x), 5.1.x (for v16.x)
Note: For Angular 10-15, use v1.x of the original package.
Installation
## Installation
```bash
npm install @phalgunv/ngx-keyboard-shortcuts --saveQuick Start
Example:
<button [keyboardShortcut]="keyboardShortcutDef" (click)="save()">
Save
</button>keyboardShortcutDef: IKeyboardShortcutListenerOptions = {
description: 'save',
keyBinding: [KeyboardKeys.Ctrl, KeyboardKeys.Shift, 's']
};Usage
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgxKeyboardShortcutModule } from '@phalgunv/ngx-keyboard-shortcuts';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
NgxKeyboardShortcutModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }Demos
see the demo site https://milestechnologies.github.io/ngx-keyboard-shortcuts
Contributing
Development Setup
npm install
npm start # Run the demo environmentTesting and Linting
npm test # Run Jest tests
npm run lint # Run ESLintBuilding
npm run build # Build the library packageBuilt With
- Angular 21 - The web framework
- TypeScript 5 - Programming language
- Jest - Testing framework
- ESLint - Code quality tool
Version
21.0.0
Migration from v1.x
If you're upgrading from v1.x:
- Angular 21+ is now required
- Node.js 20+ is required
- Peer dependencies updated to
@angular/coreand@angular/common^21.0.0
For detailed migration information, see CHANGELOG.md.
Contributors
Thank you to the contributors of this package.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
