Skip to content

Commit

Permalink
docs: Added docs to useHotkeys.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankeos committed Oct 5, 2024
1 parent 38c3e5f commit 49e54cd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/use-hotkeys/use-hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ function shouldFireEvent(
return true
}

/**
* A hook that listens to keyboard events and triggers a callback when a hotkey is pressed.
*
* @param hotkeys - An array of hotkey combinations and callbacks.
* @param tagsToIgnore - An array of HTML tag names to ignore when listening for hotkeys.
* @param triggerOnContentEditable - Whether to trigger the callback when the hotkey is pressed on a contenteditable element.
*/
export function useHotkeys(
hotkeys: HotkeyItem[],
tagsToIgnore: string[] = ['INPUT', 'TEXTAREA', 'SELECT'],
Expand Down

0 comments on commit 49e54cd

Please sign in to comment.