keys/hooks
Hooks
Per-hook API reference for @diffgazer/keys.
Keyboard and focus hooks split into two groups. Standalone hooks work anywhere — they take a ref, return handlers or run effects, and need no setup. Provider-backed hooks register through KeyboardProvider so they share one key dispatcher and participate in the scope stack; wrap your app (or the relevant subtree) in a provider to use them.
Standalone hooks
No provider required. Diffgazer packages are not yet published to npm; until the first release, pack @diffgazer/keys from the repository and install that tarball.
Provider-backed hooks
Require KeyboardProvider. Package-only, since dispatch goes through the shared registry.
tsx
Choosing a navigation hook
- Movement within one list —
useNavigation(standalone, you attachonKeyDown) oruseScopedNavigation(provider-backed, scope-aware, noonKeyDown). - Movement between regions of a layout —
useFocusZone. - A row with inline actions —
useActionRowNavigation.
See the navigation, scopes, and focus zones guides for end-to-end patterns.