Hooks
@kamod-ch/hooks
Preact-first
Built for Preact hooks, not React-compat afterthoughts. Import what you need and keep bundles lean.
Tree-shakeable
ESM package with optional subpath imports like @kamod-ch/hooks/useToggle for tight production builds.
Demo-backed docs
Every hook ships with interactive demos and copy-ready source on the dedicated live docs site.
Installation
Install @kamod-ch/hooks with Preact as a peer dependency when using the package outside the Kamod UI monorepo.
pnpm add @kamod-ch/hooks preactUsage
Start with high-traffic hooks like useToggle, useCounter, and useLocalStorageState. Prefer named imports or subpath imports for tree-shaking.
import { useToggle, useCounter, useLocalStorageState } from "@kamod-ch/hooks";
const [on, { toggle }] = useToggle(false);
const [count, { inc }] = useCounter(0);
const [theme, setTheme] = useLocalStorageState("theme", "dark");API Reference
This page is a Kamod UI overview. The full API, categorized hook tables, and TypeScript signatures live on the dedicated kamod-hooks docs.
Accessibility Notes
Pair hooks that drive UI (for example toggles, focus, and viewport observers) with clear labels, keyboard affordances, and semantic controls in your components.