API Reference
@json-render/solid
SolidJS components, providers, and hooks for rendering json-render specs.
Installation
npm install @json-render/core @json-render/solidPeer dependencies: solid-js ^1.9.0 and zod ^4.0.0.
npm install solid-js zodProviders
StateProvider
| Prop | Type | Description |
|---|---|---|
store | StateStore | External store (controlled mode). When provided,
|
initialState | Record<string, unknown> | Initial state model for uncontrolled mode. |
onStateChange | (changes: Array<{ path: string; value: unknown }>) => void | Called for uncontrolled state updates. |
ActionProvider
VisibilityProvider
ValidationProvider
JSONUIProvider
Combined provider wrapper for state, visibility, validation, and actions.
defineRegistry
Create a typed component registry and action helpers from a catalog.
Components
Renderer
Renders a Spec tree using your registry.
createRenderer
Build an app-level renderer from catalog + components:
Hooks
useStateStore()useStateValue(path)- returns an accessoruseStateBinding(path)- returns[Accessor<T | undefined>, setValue]useVisibility()/useIsVisible(condition)useActions()/useAction(binding)useValidation()/useOptionalValidation()useFieldValidation(path, config)- returns accessor-backedstate,errors, andisValiduseBoundProp(value, bindingPath)- returns[value, setValue], wherevalueis the resolved prop and not an accessoruseUIStream(options)useChatUI(options)
Built-in Actions
ActionProvider handles these built-in actions:
setStatepushStateremoveStatevalidateForm
Component Props
Registry components receive:
Use emit("event") to dispatch event bindings. Use on("event") to access EventHandle metadata (bound, shouldPreventDefault, emit).
Reactivity Notes
- Keep changing reads in JSX expressions,
createMemo, orcreateEffect. - Avoid props destructuring in component signatures when you need live updates.
StateProviderand other contexts expose getter-backed values so consumers read live signals.useStateValue,useStateBinding, anduseFieldValidationexpose reactive accessors; call them as functions.