/use-ctrl-key

React hook for listening to when the Ctrl key is pressed

Primary LanguageTypeScriptMIT LicenseMIT

useCtrlKey Tweet version minzipped size downloads build

Listen to Ctrl key events with React hooks.

Install

  • npm install use-ctrl-key or
  • yarn add use-ctrl-key

Use

import useCtrlKey from 'use-ctrl-key';

function App() {
  const ctrlKey = useCtrlKey();
  return <p>The Ctrl key is {ctrlKey ? 'pressed' : 'not pressed'}.</p>;
}

Sponsor 💗

If you are a fan of this project, you may become a sponsor via GitHub's Sponsors Program.