{"id":20614750,"url":"https://github.com/dashed/react-combokeys","last_synced_at":"2026-05-09T09:18:59.344Z","repository":{"id":66030626,"uuid":"104272683","full_name":"dashed/react-combokeys","owner":"dashed","description":"Bind to keyboard shortcuts in React.","archived":false,"fork":false,"pushed_at":"2019-05-03T07:38:43.000Z","size":2374,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T17:40:25.511Z","etag":null,"topics":["component","hotkeys","keyboard","react","shortcuts"],"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/dashed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-20T22:11:17.000Z","updated_at":"2020-11-25T05:54:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"f184a65b-c3d1-4c50-ae0e-c5fe46df707f","html_url":"https://github.com/dashed/react-combokeys","commit_stats":{"total_commits":20,"total_committers":4,"mean_commits":5.0,"dds":0.6,"last_synced_commit":"90f6d644f079176023ee5c934f04b834f0314592"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Freact-combokeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Freact-combokeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Freact-combokeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashed%2Freact-combokeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashed","download_url":"https://codeload.github.com/dashed/react-combokeys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242269117,"owners_count":20100071,"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":["component","hotkeys","keyboard","react","shortcuts"],"created_at":"2024-11-16T11:13:30.871Z","updated_at":"2026-05-09T09:18:54.298Z","avatar_url":"https://github.com/dashed.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"react-combokeys [![Build Status](https://travis-ci.org/dashed/react-combokeys.svg)](https://travis-ci.org/dashed/react-combokeys) [![npm version](https://img.shields.io/npm/v/react-combokeys.svg?style=flat)](https://www.npmjs.com/package/react-combokeys)\n===============\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/dashed/react-combokeys.svg)](https://greenkeeper.io/)\n\n\u003e Bind to [keyboard shortcuts](https://en.wikipedia.org/wiki/Keyboard_shortcut) in React.\n\n**NOTE:** This React component library wraps [combokeys](https://github.com/avocode/combokeys) which is a fork of [mousetrap](https://github.com/ccampbell/mousetrap). `combokeys` handles the capturing of keyboard shortcuts/combos/keypresses.\n\n## Install\n\n```sh\n$ yarn add react-combokeys\n# npm v5+\n$ npm install react-combokeys\n# before npm v5\n$ npm install --save react-combokeys\n```\n\n## Usage\n\n```js\n// 3rd-party imports\n\nimport ReactDOM from \"react-dom\";\nimport React, { Component } from \"react\";\n\nimport ComboKeys from \"react-combokeys\";\n\n// function as child component\n\nReactDOM.render(\n    \u003cComboKeys bind={[\"a\", \"command+shift+k\"]} keyup=\"b\" keydown=\"c\"\u003e\n        {({ combo }) =\u003e {\n            return \u003cdiv\u003e{`Combo: ${combo || \"none yet\"}`}\u003c/div\u003e;\n        }}\n    \u003c/ComboKeys\u003e,\n    mountNode\n);\n\n// render prop\n\nconst render = ({ combo }) =\u003e {\n    return \u003cdiv\u003e{`Combo: ${combo || \"none yet\"}`}\u003c/div\u003e;\n};\n\nReactDOM.render(\n    \u003cComboKeys\n        bind={[\"a\", \"command+shift+k\"]}\n        keyup=\"b\"\n        keydown=\"c\"\n        render={render}\n    /\u003e,\n    mountNode\n);\n```\n\n## Props\n\n### `render` (optional)\n\nAn optional function that is called whenever a keyboard shortcut/combo has been detected, or when internal state for tracking keyboard shortcut/combo has changed.\n\n It's expected that `render` function returns a single React element.\nThis has same API semantics as [`React.Component.render()`](https://facebook.github.io/react/docs/react-component.html#render).\n\nIf `render` function is given, it has precedence over any given child component:\n\n```js\n// TODO: add example\n```\n\n\n### Function as child component (optional)\n\nSame semantics as `render` prop function (see above).\n\nIf `render` function is not given, then the child component will be invoked as a function.\n\n```js\n// TODO: add example\n```\n\n### `onCombo` (optional)\n\nAn optional function that is called whenever a keyboard shortcut/combo has been detected.\n\nThe `onCombo` function is invoked with an object argument: `({ event, combo, action })`.\n\n\nCredits\n=======\n\nSome parts of code (e.g. `getRootProps()`) were blatantly copied from: https://github.com/paypal/downshift\n\nKudos to [@kentcdodds](https://github.com/kentcdodds) and his article [here](http://tinyletter.com/kentcdodds/letters/how-to-give-rendering-control-to-users-with-prop-getters), for inspiring me to create this React component library using the ideas that he (and others) have preached.\n\nLicense\n=======\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashed%2Freact-combokeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashed%2Freact-combokeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashed%2Freact-combokeys/lists"}