Skip to main content
Action creators for dispatching state changes in JSON Forms. These functions create action objects compatible with Redux reducers.

Core Actions

init

Initialize JSON Forms with data, schema, and UI schema.
function init(
  data: any,
  schema?: JsonSchema,
  uischema?: UISchemaElement,
  options?: InitActionOptions | AJV
): InitAction
data
any
required
The initial form data
schema
JsonSchema
The JSON schema describing the data structure. If not provided, a schema will be generated from the data.
uischema
UISchemaElement
The UI schema describing how to render the form. If not provided, a default UI schema will be generated.
options
InitActionOptions | AJV
Configuration options:
  • ajv: Custom AJV instance for validation
  • validationMode: Validation mode (‘ValidateAndShow’, ‘ValidateAndHide’, ‘NoValidation’)
  • additionalErrors: Additional validation errors
return
InitAction
Action object with type jsonforms/INIT
Example:
import { init } from '@jsonforms/core';

const action = init(
  { name: 'John', age: 30 },
  {
    type: 'object',
    properties: {
      name: { type: 'string' },
      age: { type: 'number' }
    }
  },
  {
    type: 'VerticalLayout',
    elements: [
      { type: 'Control', scope: '#/properties/name' },
      { type: 'Control', scope: '#/properties/age' }
    ]
  }
);

update

Update form data at a specific path.
function update(
  path: string,
  updater: (existingData: any) => any,
  context?: object
): UpdateAction
path
string
required
Data path in dot notation (e.g., ‘person.address.city’)
updater
(existingData: any) => any
required
Function that receives the current value and returns the new value
context
object
Optional context object, typically an UpdateArrayContext for array operations
return
UpdateAction
Action object with type jsonforms/UPDATE
Example:
import { update } from '@jsonforms/core';

// Update a simple value
const action = update('name', () => 'Jane');

// Update with context for array operations
const arrayAction = update(
  'items',
  (items) => [...items, newItem],
  { type: 'ADD', values: [newItem] }
);

updateCore

Update multiple core state properties at once.
function updateCore(
  data: any,
  schema: JsonSchema,
  uischema?: UISchemaElement,
  options?: AJV | InitActionOptions
): UpdateCoreAction
data
any
required
New form data
schema
JsonSchema
required
New JSON schema
uischema
UISchemaElement
New UI schema
options
AJV | InitActionOptions
AJV instance or options object
return
UpdateCoreAction
Action object with type jsonforms/UPDATE_CORE

setSchema

Set or update the JSON schema.
function setSchema(schema: JsonSchema): SetSchemaAction
schema
JsonSchema
required
The new JSON schema
return
SetSchemaAction
Action object with type jsonforms/SET_SCHEMA

setUISchema

Set or update the UI schema.
function setUISchema(uischema: UISchemaElement): SetUISchemaAction
uischema
UISchemaElement
required
The new UI schema
return
SetUISchemaAction
Action object with type jsonforms/SET_UISCHEMA

updateErrors

Update validation errors.
function updateErrors(errors: ErrorObject[]): UpdateErrorsAction
errors
ErrorObject[]
required
Array of AJV error objects
return
UpdateErrorsAction
Action object with type jsonforms/UPDATE_ERRORS

setValidationMode

Set the validation mode.
function setValidationMode(
  validationMode: ValidationMode
): SetValidationModeAction
validationMode
ValidationMode
required
One of: ‘ValidateAndShow’, ‘ValidateAndHide’, ‘NoValidation’
return
SetValidationModeAction
Action object with type jsonforms/SET_VALIDATION_MODE

Renderer Actions

registerRenderer

Register a custom renderer.
function registerRenderer(
  tester: RankedTester,
  renderer: any
): AddRendererAction
tester
RankedTester
required
Function that returns a rank number indicating renderer applicability
renderer
any
required
The renderer component (React, Angular, Vue, etc.)
return
AddRendererAction
Action object with type jsonforms/ADD_RENDERER

unregisterRenderer

Unregister a custom renderer.
function unregisterRenderer(
  tester: RankedTester,
  renderer: any
): RemoveRendererAction

registerCell

Register a custom cell renderer.
function registerCell(
  tester: RankedTester,
  cell: any
): AddCellRendererAction

unregisterCell

Unregister a custom cell renderer.
function unregisterCell(
  tester: RankedTester,
  cell: any
): RemoveCellRendererAction

UI Schema Actions

registerUISchema

Register a UI schema for dynamic resolution.
function registerUISchema(
  tester: UISchemaTester,
  uischema: UISchemaElement
): AddUISchemaAction
tester
UISchemaTester
required
Function that returns a rank number for schema matching
uischema
UISchemaElement
required
The UI schema to register
return
AddUISchemaAction
Action object with type jsonforms/ADD_UI_SCHEMA

unregisterUISchema

Unregister a UI schema.
function unregisterUISchema(
  tester: UISchemaTester
): RemoveUISchemaAction

Configuration Actions

setConfig

Set form-wide configuration options.
function setConfig(config: any): SetConfigAction
config
any
required
Configuration object (structure depends on renderers)
return
SetConfigAction
Action object with type jsonforms/SET_CONFIG

Internationalization Actions

setLocale

Set the current locale.
function setLocale(locale: string | undefined): SetLocaleAction

setTranslator

Set translation functions.
function setTranslator(
  translator?: Translator,
  errorTranslator?: ErrorTranslator
): SetTranslatorAction

updateI18n

Update locale and translators.
function updateI18n(
  locale: string | undefined,
  translator: Translator | undefined,
  errorTranslator: ErrorTranslator | undefined
): UpdateI18nAction

Default Data Actions

registerDefaultData

Register default data for a schema path.
function registerDefaultData(
  schemaPath: string,
  data: any
): RegisterDefaultDataAction

unregisterDefaultData

Unregister default data for a schema path.
function unregisterDefaultData(
  schemaPath: string
): UnregisterDefaultDataAction

Action Type Constants

export const INIT = 'jsonforms/INIT';
export const UPDATE_CORE = 'jsonforms/UPDATE_CORE';
export const UPDATE_DATA = 'jsonforms/UPDATE';
export const UPDATE_ERRORS = 'jsonforms/UPDATE_ERRORS';
export const SET_SCHEMA = 'jsonforms/SET_SCHEMA';
export const SET_UISCHEMA = 'jsonforms/SET_UISCHEMA';
export const SET_VALIDATION_MODE = 'jsonforms/SET_VALIDATION_MODE';
export const SET_AJV = 'jsonforms/SET_AJV';
export const ADD_RENDERER = 'jsonforms/ADD_RENDERER';
export const REMOVE_RENDERER = 'jsonforms/REMOVE_RENDERER';
export const ADD_CELL = 'jsonforms/ADD_CELL';
export const REMOVE_CELL = 'jsonforms/REMOVE_CELL';
export const SET_CONFIG = 'jsonforms/SET_CONFIG';
export const ADD_UI_SCHEMA = 'jsonforms/ADD_UI_SCHEMA';
export const REMOVE_UI_SCHEMA = 'jsonforms/REMOVE_UI_SCHEMA';
export const SET_LOCALE = 'jsonforms/SET_LOCALE';
export const SET_TRANSLATOR = 'jsonforms/SET_TRANSLATOR';
export const UPDATE_I18N = 'jsonforms/UPDATE_I18N';
export const ADD_DEFAULT_DATA = 'jsonforms/ADD_DEFAULT_DATA';
export const REMOVE_DEFAULT_DATA = 'jsonforms/REMOVE_DEFAULT_DATA';

Build docs developers (and LLMs) love