@lacspace/hotkeys
Ergonomic keyboard shortcuts for React — combos (mod+k), key sequences (g then d), scopes, and pretty display formatting (⌘K). SSR-safe, respects form fields, zero-dependency, fully typed.
npm i @lacspace/hotkeysUsage
import { useState } from "react";
import { useHotkeys, formatHotkey } from "@lacspace/hotkeys";
function App() {
const [open, setOpen] = useState(false);
// ⌘K on mac, Ctrl+K elsewhere. preventDefault is on by default.
useHotkeys("mod+k", () => setOpen((v) => !v));
return (
<>
<button onClick={() => setOpen(true)}>
Search <kbd>{formatHotkey("mod+k")}</kbd>
</button>
{open && <CommandPalette onClose={() => setOpen(false)} />}
</>
);
}Exports 10
disableScopeenableScopeformatHotkeyisMacisScopeActivematchesHotkeyparseHotkeytoggleScopeuseHotkeysuseHotkeysScopesKeywords
More in React Kit
Essential, SSR-safe React hooks — useLocalStorage, useDebounce, useMediaQuery, useOnClickOutside, useCopyToClipboard and 20+ more. Zero-dependency, fully typed, isomorphic.
@lacspace/queryTiny data fetching for React with a shared cache, request de-duplication, stale-while-revalidate, focus/reconnect revalidation, and mutations. useQuery + useMutation in ~2KB. Zero-dependency, SSR-safe, fully typed.
@lacspace/storeMinimal global state for React in ~1KB — create a store, use selectors, no provider. Built on useSyncExternalStore with a persist middleware and shallow equality. Zero-dependency, SSR-safe, fully typed.
@lacspace/themeSSR-safe dark / light / system theme for React — a tiny ThemeProvider, a useTheme hook, and a no-flash inline script. Persists to storage, follows the OS, toggles a class or data-attribute. Zero-dependency, framework-agnostic, fully typed.
@lacspace/uiA tiny, dependency-free React kit that makes a page feel alive — scroll reveals, animated counters, gradient text, tilt cards, marquees, a typewriter and a ⌘K command palette. No animation library, no CSS import. Respects prefers-reduced-motion; Tailwind-friendly.
@lacspace/virtualHeadless list virtualization for React — render only the rows in view, with fixed or dynamically-measured sizes, overscan, and scroll-to-index. useVirtualizer in ~2KB. Zero-dependency, SSR-safe, fully typed.