{"id":28281543,"url":"https://github.com/phantomstudios/use-key","last_synced_at":"2026-03-06T10:32:15.116Z","repository":{"id":42452841,"uuid":"413174775","full_name":"phantomstudios/use-key","owner":"phantomstudios","description":"A simple React hook for listening to custom keyboard events.","archived":false,"fork":false,"pushed_at":"2025-11-17T17:51:43.000Z","size":977,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-17T18:24:41.746Z","etag":null,"topics":["hook","hooks","keyboard","listener","react","react-hook","state"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phantomstudios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-03T19:19:30.000Z","updated_at":"2025-11-17T17:49:59.000Z","dependencies_parsed_at":"2025-04-01T16:32:49.525Z","dependency_job_id":"d4202d42-01d1-4f8d-ac80-95198ffd430a","html_url":"https://github.com/phantomstudios/use-key","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/phantomstudios/use-key","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Fuse-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Fuse-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Fuse-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Fuse-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phantomstudios","download_url":"https://codeload.github.com/phantomstudios/use-key/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phantomstudios%2Fuse-key/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30171869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["hook","hooks","keyboard","listener","react","react-hook","state"],"created_at":"2025-05-21T12:13:13.330Z","updated_at":"2026-03-06T10:32:15.100Z","avatar_url":"https://github.com/phantomstudios.png","language":"JavaScript","readme":"# use-key\n\n[![NPM version][npm-image]][npm-url]\n[![Actions Status][ci-image]][ci-url]\n[![PR Welcome][npm-downloads-image]][npm-downloads-url]\n\nA simple React hook for listening to custom keyboard events. This hook is also SSR safe and does not break when used without `window` existing.\n\n## Installation\n\nInstall this package with `npm`.\n\n```bash\nnpm i @phntms/use-key\n```\n\n## Usage\n\nTo listen to a single key:\n\n```jsx\nimport useKey from \"@phntms/use-key\";\n\nuseKey(\"Escape\", (pressed: boolean) =\u003e {\n  if (pressed) // Do something on \"Escape\"...\n});\n```\n\nTo listen to key modifiers:\n\n```jsx\nimport useKey from \"@phntms/use-key\";\n\nuseKey(\"g\", (pressed: boolean, event: KeyboardEvent) =\u003e {\n  if (pressed \u0026\u0026 event.ctrlKey) // Do something on \"Ctrl + G\"...\n});\n```\n\n## API\n\nThe hook uses [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) under the hood. This means using the `onChange` event, you can get the state of modifier keys such as Shift as well as the keyboard locale and layout.\n\n## Contributing\n\nWant to get involved, or found an issue? Please contribute using the GitHub Flow. Create a branch, add commits, and open a Pull Request or submit a new issue.\n\nPlease read `CONTRIBUTING` for details on our `CODE_OF_CONDUCT`, and the process for submitting pull requests to us!\n\n[npm-image]: https://img.shields.io/npm/v/@phntms/use-key.svg?style=flat-square\u0026logo=react\n[npm-url]: https://npmjs.org/package/@phntms/use-key\n[npm-downloads-image]: https://img.shields.io/npm/dm/@phntms/use-key.svg\n[npm-downloads-url]: https://npmcharts.com/compare/@phntms/use-key?minimal=true\n[ci-image]: https://github.com/phantomstudios/use-key/workflows/test/badge.svg\n[ci-url]: https://github.com/phantomstudios/use-key/actions\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantomstudios%2Fuse-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphantomstudios%2Fuse-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantomstudios%2Fuse-key/lists"}