Hooks

@kamod-ch/hooks

kamod-hooks · Preact-first · Typed · Tree-shakeable

Ship Preact features faster with production-ready hooks

A Preact-first hook library inspired by ahooks — state, lifecycle, browser, and async helpers with zero runtime dependencies beyond Preact.

78
documented hooks
0
runtime deps in core
TS
published signatures
  • 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 preact

Usage

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.

Full API reference on live 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.