Long-press `⌘` key or press `?` to present a shortcut guide for your Web application.

Overview

React Shortcut Guide

Status: Alpha

Long-press command or press ? to present a shortcut guide for your Web application.

Gzip+minify < 3kB

Install

npm i react-shortcut-guide

Usage

  1. Wrap ShortcutProvide on root App component.
import React from 'react'
import { render } from 'react-dom'
import { ShortcutProvider } from 'react-shortcut-guide'

render(<App />, document.getElementById('app'))

function App() {
  return (
    <ShortcutProvider
      options={{
        darkMode: 'media',
      }}
    >
      <Comp />
    </ShortcutProvider>
  )
}
  1. Register a shortcut by hook.
import { useShortcut } from 'react-shortcut-guide'

useShortcut(
  'A',
  [Modifier.Meta],
  (e) => {
    console.log('a')
  },
  'Print A',
  options,
)

Options

ProviderOptions:

type ShortcutOptions = {
  darkMode?: 'media' | 'class'
  /**
   * @default 'body.dark'
   */
  darkClassName?: string

  /**
   * 长按 Command 呼出的时间
   * @default 1000
   */
  holdCommandTimeout?: number

  /**
   * 释放 Command 后的 Guide Panel 停留时间
   * @default 1000
   */
  stayCommandTimeout?: number

  /**
   * Guide 打开事件
   */
  onGuidePanelOpen?: () => any
  /**
   * Guide 关闭事件
   */
  onGuidePanelClose?: () => any
}

Hook Options:

type RegisterShortcutOptions = {
  /**
   * 在输入框上禁用快捷键
   * @default true
   */
  preventInput?: boolean
  /**
   * 不在 Guide 上显示这个快捷键指令
   * @default false
   */
  hiddenInPanel?: boolean
}

Reference

TODO

  • 分页
You might also like...

Use this project as a tool for remembering your daily tasks, confirming, editing, remove are actions you can do to tasks, your data is saved in the LocalStorage so every time you open or refresh the page all changes will be present.

To-do-list The porpuse for this project is show You, the way how to implement webpack in a project creating a To-Do list in for add a template to crea

Nov 18, 2022

Present your links in style 🔗🔮

Present your links in style 🔗🔮

links Present your links in style 🔗 🔮 links screenshot Have you ever wanted a place that can make all your profiles and links nicely organized, easi

Nov 25, 2022

HackFest is a 36-hour long hackathon wherein you have to put on your hacker hats and build anything that falls in either or both the domain of full-stack web development

HackFest is a 36-hour long hackathon wherein you have to put on your hacker hats and build anything that falls in either or both the domain of full-stack web development

HackFest is a 36-hour long hackathon wherein you have to put on your hacker hats and build anything that falls in either or both the domain of full-stack web development (the stack we learn in full-stack web developer roadmap on codedamn).

Jun 6, 2022

Crypto Basket - Free Blockchain Press Release

ADD YOUR CONTENT Upload all files to IPFS All non-IPFS links should be inside LINKS Sections Use markdown syntax How to add content to CryptoBasket ?

Dec 15, 2022

Website to present projects made by me and that are part of my personal portfolio. It was made using React, HTML y Scss (CSS).

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Dec 23, 2021

kimchi is a staple Korean side dish that's present at almost every meal.

(✿◠‿◠)*:・゚✧ (c) 02/2021 Dear reader, Essentially, kimchi is a staple Korean side dish that's present at almost every meal. It's fermented napa cabbage

Sep 20, 2022

The Covid-19 data-app collects information from API and present data for the novel coronavirus.

The Covid-19 data-app collects information from API and present data for the novel coronavirus.

COVID-19-data-app This project was bootstrapped with Create React App. The Covid-19 data-app collects information from API and present data for the no

Jun 23, 2022

This blog is still under development! I present a project scope for science articles, it can now be used in production! But there are some details that need to be put up front.

Science-Blog 🛑 Attention! This blog is still under development! I present a project scope for science articles, it can now be used in production! But

Sep 19, 2022

nice-dag is a lightweight javascript library, which is used to present a DAG diagram.

nice-dag is a lightweight javascript library, which is used to present a DAG diagram.

Nice-DAG Overview Nice-DAG is a lightweight javascript library, which is used to present a DAG diagram. Essentially, it uses dagre to layout nodes and

Oct 25, 2022
Adds `long-press` event to the DOM in 1k of pure JavaScript

long-press-event A 1k script that adds a long-press event to the DOM using CustomEvent and pure JavaScript. Works in IE9+, Chrome, Firefox, Safari as

John Doherty 262 Jan 2, 2023
A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

Devang Joshi 1 Mar 1, 2021
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Tool to sign data with a Cardano-Secret-Key // verify data with a Cardano-Public-Key // generate CIP-8 & CIP-36 data

Tool to sign data with a Cardano-Secret-Key // verify data with a Cardano-Public-Key // generate CIP-8 & CIP-36 data

Martin Lang 11 Dec 21, 2022
F-Curator is an offline application that comes at you all day long and curates your own web favorites

F-Curator F-Curator is an offline application that comes at you all day long and curates your own web favorites. Based on Electron and React technolog

UIUX Lab 21 Dec 25, 2022
Keyboard shortcut handler. KISS, light and library free.

Shortcut.js Shortcut.js is a JavaScript ES6 component that offers a global keyboard event handler. This way one can declare and react to any combinati

Arthur Beaulieu 4 Sep 28, 2022
CSS sprite to represent iOS shortcut icons

shortcut-icons A CSS sprite to represent iOS shortcut icons. Grab the stylesheet and the default (iOS 15) glyph set, and add a shortcut icon to your H

Antonio Bueno 18 Nov 14, 2022
Use XMind share to present your .xmind files on your blog or website.

XMind Embed Viewer Use XMind share to present your .xmind files on your blog or website. Demo Quick start Install As an npm module npm i xmind-embed-v

XMind Ltd. 25 Dec 7, 2022