react-hotkeys
Installation
SKILL.md
TanStack Hotkeys in React
Before starting, load the @tanstack/hotkeys#hotkeys-core skill (npx @tanstack/intent@latest load @tanstack/hotkeys#hotkeys-core).
import { formatForDisplay, useHotkey } from '@tanstack/react-hotkeys'
export function SaveButton({ onSave }: { onSave: () => void }) {
useHotkey('Mod+S', () => onSave(), { meta: { name: 'Save' } })
return (
<button onClick={onSave}>
Save <kbd>{formatForDisplay('Mod+S')}</kbd>
</button>
)
}