{"id":13450749,"url":"https://github.com/sandiiarov/use-hotkeys","last_synced_at":"2025-03-23T16:32:14.545Z","repository":{"id":55858918,"uuid":"172000524","full_name":"sandiiarov/use-hotkeys","owner":"sandiiarov","description":"➷ Hotkeys React Hook","archived":true,"fork":false,"pushed_at":"2020-12-11T02:13:53.000Z","size":429,"stargazers_count":18,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-28T17:39:27.028Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandiiarov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-22T05:33:43.000Z","updated_at":"2023-02-01T01:41:41.000Z","dependencies_parsed_at":"2022-08-15T08:00:21.293Z","dependency_job_id":null,"html_url":"https://github.com/sandiiarov/use-hotkeys","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandiiarov%2Fuse-hotkeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandiiarov%2Fuse-hotkeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandiiarov%2Fuse-hotkeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandiiarov%2Fuse-hotkeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandiiarov","download_url":"https://codeload.github.com/sandiiarov/use-hotkeys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245130987,"owners_count":20565754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T07:00:37.991Z","updated_at":"2025-03-23T16:32:14.256Z","avatar_url":"https://github.com/sandiiarov.png","language":"TypeScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# Use Hotkeys\n\n![npm](https://img.shields.io/npm/dt/use-hotkeys.svg)\n![npm](https://img.shields.io/npm/v/use-hotkeys.svg)\n![NpmLicense](https://img.shields.io/npm/l/use-hotkeys.svg)\n\nReact wrapper around [Hotkeys.js](https://github.com/jaywcjlove/hotkeys).\n\n```shell\n╭┈┈╮          ╭┈┈╮  ╭┈┈╮\n┆  ├┈┈..┈┈┈┈┈.┆  └┈╮┆  ├┈┈..┈┈┈┈┈..┈┈.┈┈..┈┈┈┈┈.\n┆     ┆┆  □  ┆┆   ┈┤┆    \u003c ┆  -__┘┆  ┆  ┆┆__ ┈┈┤\n╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈┈╯╰┈┈┴┈┈╯╰┈┈┈┈┈╯╰┈┈┈  ┆╰┈┈┈┈┈╯\n                                  ╰┈┈┈┈┈╯\n```\n\n**Use Hotkeys** - React hook that listen to keyboard events, defining and dispatching keyboard shortcuts.\n\nRead about [Hooks](https://reactjs.org/docs/hooks-intro.html) feature.\n\n## Installation\n\n\u003e Note: React 16.8+ is required for Hooks.\n\n### With npm\n\n```sh\nnpm i use-hotkeys\n```\n\n### Or with yarn\n\n```sh\nyarn add use-hotkeys\n```\n\n## Usage\n\n[![Edit 1llx4n8q4](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/1llx4n8q4?fontsize=14)\n\n```jsx\nimport useHotkeys from 'use-hotkeys';\n```\n\n```jsx\nconst Counter = () =\u003e {\n  const [count, setCount] = React.useState(0);\n\n  useHotkeys(\n    (key, event, handle) =\u003e {\n      switch (key) {\n        case 'up':\n          return setCount(count + 1);\n        case 'down':\n          return setCount(count - 1);\n        default:\n          return setCount(count);\n      }\n    },\n    ['up', 'down'],\n    [count]\n  );\n\n  return \u003cdiv\u003e{count}\u003c/div\u003e;\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandiiarov%2Fuse-hotkeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandiiarov%2Fuse-hotkeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandiiarov%2Fuse-hotkeys/lists"}