Skip to content

phalgunv/ngx-keyboard-shortcuts

 
 

Repository files navigation

@phalgunv/ngx-keyboard-shortcuts

⚠️ Maintained Fork: This is an actively maintained fork of the original ngx-keyboard-shortcuts package (now archived). This fork adds Angular 16+, 17+, 18+, 19+, 20+, and 21+ support with modern tooling.

npm version

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 --save

Quick 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 environment

Testing and Linting

npm test        # Run Jest tests
npm run lint    # Run ESLint

Building

npm run build   # Build the library package

Built With

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/core and @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.

About

provides for easy setup and management of keyboard shortcuts in an angular 2+ project

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 91.0%
  • HTML 6.4%
  • JavaScript 1.4%
  • SCSS 1.2%