OriaTheme
GitHub

API reference · React

@oriatheme/react

Connect one runtime external store to React with a Provider and Hooks; no second state machine.

Package and environment

Browser Provider for React 18.2 or 19; the module itself is SSR-safe to import.

bash
pnpm add @oriatheme/presets @oriatheme/runtime-dom @oriatheme/react

Use the package manager and lockfile already chosen by the consumer project. Examples use package-root exports only; do not deep-import from src, dist, or registry templates.

Exports

ExportSignatureDescription
OriaThemeProvider({ config, runtime?, children }: OriaThemeProviderProps) => ReactElementStarts an owned runtime or uses the supplied runtime for descendants.
useOriaTheme() => { snapshot, runtime, setTheme, setAppearance }Reads the full immutable runtime snapshot and bound actions.
useThemeSnapshot<T>(selector, isEqual?) => TSelects a snapshot slice while preserving equal references.
tsx
import { OriaThemeProvider, useOriaTheme } from "@oriatheme/react";

function Controls() {
  const { setAppearance, setTheme } = useOriaTheme();
  return <button onClick={() => setTheme("oria-ocean")}>Ocean</button>;
}

Important types and boundaries

OriaThemeProviderProps accepts an OriaThemeConfig or external OriaThemeRuntime. Mount the Provider only on the client; for Next first paint, output validated default variables and a Bootstrap script first.