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/reactbash
npm install @oriatheme/presets @oriatheme/runtime-dom @oriatheme/reactbash
yarn add @oriatheme/presets @oriatheme/runtime-dom @oriatheme/reactbash
bun add @oriatheme/presets @oriatheme/runtime-dom @oriatheme/reactUse 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
| Export | Signature | Description |
|---|---|---|
OriaThemeProvider | ({ config, runtime?, children }: OriaThemeProviderProps) => ReactElement | Starts 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?) => T | Selects 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.