GithubHelp home page GithubHelp logo

leecade / react-hotkey-tooltip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emasuriano/react-hotkey-tooltip

0.0 2.0 0.0 2.78 MB

A global Hotkey provider with built in tooltip for React

Home Page: https://react-hotkey-tooltip.netlify.com

License: MIT License

JavaScript 100.00%

react-hotkey-tooltip's Introduction

React Hotkey Tooltip

Greenkeeper badge Travis badge npm version Coverage Status eslint code style: prettier

A global Hotkey provider with built in tooltip for React

Docs

Why you should use it?

When working with hotkeys in a React application we will find many problems when trying to implement it:

  • Hotkeys are only accesible inside a specific component (not globally).
  • Must take care of the hotkeys manually throughout the life cycle.
  • Have to provide a way so the user can see all the hotkeys on the screen.

This library will help you by declaring global hotkeys that automatically will be updated by any life cycle of the component and show a tooltip by pressing a combination of keys โœจ

Built with

Why mess up with document.addEventListener or positioning/styling tooltips if there are a lot of open source libraries that can do that for me. This are the chosen ones!

  • mousetrap: to bind and unbind hotkeys globally ๐ŸŒ
  • react-tippy: to display beautiful tooltips ๐Ÿ˜„

Installation

The library is available as a package in npm and yarn, so use the one you prefer.

# npm
$ npm install react-hotkey-toolip

# yarn
$ yarn add react-hotkey-tooltip

Example

import React from 'react';
import { Hotkey, HotkeyProvider } from 'react-hotkey-tooltip';

const ClickableButtonByPressingA = () => (
  <HotkeyProvider>
    <Hotkey combination="a" onPress="click">
      <button onClick={() => alert('You have clicked me!')}>
        Click me using your keyboard!
      </button>
    </Hotkey>
  </HotkeyProvider>
);

License

MIT. Also check react-tippy.js' and mousetrap' license.

react-hotkey-tooltip's People

Contributors

catodapice avatar emasuriano avatar greenkeeper[bot] avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.