Keyboard commands for React
A typed keyboard engine for React. Hotkeys, sequences, chords, a key recorder, and a Mod key that fits each platform.
useKeyBind
Binds one combo, like
ctrl+k,meta+shift+p, ormod+s. Platform-aware, withpreventDefaultsupport.useKeySequence
Multi-step sequences like
gthend, with a configurable timeout between steps and chord mode.useKeyCommands
Registers a whole command palette at once. Bind each command to a shortcut and render the list.
useKeyRecorder
Records key presses for settings screens, so users can pick their own shortcuts and you can save them.
Mod key
ModmeansCmdon macOS andCtrleverywhere else. One binding feels native on both.Framework-agnostic core
The parser, matcher, sequence engine, and recorder are plain TypeScript. The React hooks are a thin layer on top.
Install
Wrap your app in KeyProvider, then start binding.
Install
bun add @gentleduck/vimBind your first shortcut
import { KeyProvider, useKeyBind } from '@gentleduck/vim/react'
Free & open source
gentleduck is MIT licensed and will always be free and open source. Every package ships with full source access — fork it, modify it, own it.