Overview
Ninja Keys is a keyboard shortcut interface for websites that works with Vanilla JS, Vue, and React. It allows users to quickly navigate and perform actions on websites using keyboard shortcuts. The library is lightweight and customizable, making it suitable for various types of websites.
Features
- Keyboard navigation: Users can navigate through the website using keyboard shortcuts.
- Light and dark theme: The library comes with built-in light and dark themes.
- Built-in icon support: Ninja Keys supports icons from the Material font and custom SVG icons.
- Nested menu: Users can organize shortcuts in a tree or flat data structure.
- Root search: The search functionality allows users to easily find shortcuts within submenus.
- CSS variable customization: Users can customize the appearance of Ninja Keys using CSS variables.
- Customizable hotkeys: The hotkeys for opening, closing, and navigation can be customized to fit the website’s needs.
Installation
To install Ninja Keys, you can choose one of the following methods:
Install from NPM
If you are using a build system like webpack, rollup, or vite, you can install Ninja Keys from NPM using the following command:
npm install ninja-keys
Install from CDN
If you are using HTML/JS without a build system, you can include Ninja Keys directly from a CDN like so:
<script src="https://cdn.jsdelivr.net/npm/ninja-keys@1.0.0/dist/ninja-keys.min.js"></script>
Usage
After installing Ninja Keys, you can add the <ninja-keys>
tag to your HTML. You can use a flat data structure or a tree structure to define your shortcuts. The library provides various attributes that you can use to customize its behavior, such as placeholder
, disableHotkeys
, hideBreadcrumbs
, openHotkey
, navigationUpHotkey
, navigationDownHotkey
, and closeHotkey
.
Summary
Ninja Keys is a versatile keyboard shortcut interface for websites, compatible with Vanilla JS, Vue, and React. It offers features like keyboard navigation, light and dark themes, icon support, nested menus, root search, customization options, and customizable hotkeys. With Ninja Keys, users can become keyboard ninjas and quickly navigate and perform actions on websites with ease.