Skip to content

Type Alias: FormulaFormProps<T, S, F>

FormulaFormProps<T, S, F> = FormProps<T, S, F> & object

Defined in: FormulaForm.tsx:17

Props accepted by FormulaForm.

Extends all standard RJSF FormProps with formula-specific configuration. All formula-specific props are optional except evaluator.

Type Declaration

debounceMs?

optional debounceMs?: number

Milliseconds to debounce formula evaluation after a user input event. Defaults to 300. Set to 0 to disable the debounce delay and evaluate on the next event loop tick.

evaluator

evaluator: (formula, context) => unknown | Promise<unknown>

Evaluates a formula string against a context object and returns the computed value.

Parameters

formula

string

The formula string from the schema.

context

object

Sibling field values, or full form data in extended mode.

Returns

unknown | Promise<unknown>

The computed value, or a Promise resolving to it.

Remarks

May return a plain value or a Promise. For user-supplied formulas, do not use eval — it allows arbitrary code execution. Prefer a sandboxed evaluator such as expr-eval or mathjs. For additional isolation, run the evaluator in a Web Worker.

Form?

optional Form?: React.ComponentType<FormProps<T, S, F>>

Inner RJSF Form component to render. Defaults to Form from @rjsf/core. Swap to use a themed form (e.g. Form from @rjsf/bootstrap-4).

formulaConflictBehavior?

optional formulaConflictBehavior?: "ignore" | "warn" | "error"

What to do when multiple branches of a composition operator (allOf at schema-analysis time, or simultaneously-active oneOf/anyOf branches at evaluation time) define a formula for the same field path.

  • 'ignore' — silently take the last definition.
  • 'warn' (default) — emit console.warn and take the last definition.
  • 'error' — throw a TypeError synchronously (useful during development).

formulaContextKey?

optional formulaContextKey?: string

Schema key that selects the context mode for a field. Defaults to 'x-formula-context'.

formulaDataKey?

optional formulaDataKey?: string

Key injected into the extended context carrying the full form data. Defaults to '__formData__'. Override if a sibling field uses the same name.

formulaKey?

optional formulaKey?: string

Schema key that marks a field as computed. Defaults to 'x-formula'.

formulaPathKey?

optional formulaPathKey?: string

Key injected into the extended context carrying the field's resolved path. Defaults to '__path__'. Override if a sibling field uses the same name.

maxConvergencePasses?

optional maxConvergencePasses?: number

Maximum number of re-evaluation passes triggered by a single input event. Guards against infinite loops from circular formula dependencies. Defaults to 10.

onFormulaError?

optional onFormulaError?: (path, error) => void

Called when a formula throws during evaluation.

Parameters

path

(string | number)[]

JSON path of the field whose formula failed.

error

Error

The error thrown by the evaluator.

Returns

void

onLoadingChange?

optional onLoadingChange?: (loadingPaths) => void

Called whenever the set of currently-evaluating fields changes. Useful for showing per-field loading indicators.

Parameters

loadingPaths

(string | number)[][]

Paths of all fields whose evaluations are in progress.

Returns

void

Type Parameters

T

T = any

S

S extends StrictRJSFSchema = RJSFSchema

F

F extends FormContextType = any

Released under the MIT License.