useHotkey
Listen for keyboard shortcut combos.
Import
import { useHotkey } from "neoterm-ui";Usage
useHotkey("Meta+k", () => setCommandPaletteOpen(true));
useHotkey("Ctrl+Shift+p", () => togglePreview());
useHotkey("Escape", () => closeModal());Signature
function useHotkey(combo: string, callback: () => void): void
Parameters
| Prop | Type | Default | Description |
|---|---|---|---|
| combo | string | — | Key combo string, e.g. "Meta+k", "Ctrl+Shift+p". |
| callback | () => void | — | Function called when the combo is pressed. |