Signals

@kamod-ch/signals

kamod-signals · Persisted state · Familiar .value API

Persisted Preact signals for every storage driver

Reactive state with durable storage — localStorage, sessionStorage, IndexedDB, cookies, and memory — while keeping the familiar @preact/signals .value API.

5
storage drivers
SSR
cookie context
.value
signals API
  • Persistence built in

    persistedSignal and usePersistedSignal sync reactive values to the driver you choose.

  • Framework friendly

    Works beside Preact components and plain modules — share state across controllers without prop drilling.

  • SSR-aware cookies

    createCookieContext and serializeCookie helpers keep cookie-backed signals usable on the server.

Installation

Install @kamod-ch/signals with @preact/signals and Preact as peer dependencies when using the package outside the Kamod UI monorepo.

pnpm add @kamod-ch/signals @preact/signals preact

Usage

Create a persisted signal with a storage key and driver, then read or write .value as usual. Use usePersistedSignal inside components for scoped instances.

import { persistedSignal } from "@kamod-ch/signals";

export const theme = persistedSignal("theme", "dark", { storage: "local" });

// later
theme.value = "light";

API Reference

This page is a Kamod UI overview. Full API docs, driver tables, and SSR cookie examples live on the dedicated kamod-signals docs.

Full API reference on live docs

Accessibility Notes

When signals drive UI chrome (theme, sidebar, locale), reflect state in accessible controls and keep preference changes predictable for keyboard and assistive tech users.