dynamic-forms / Interface

CustomFunctionOptions

Options for registering a custom function.

Properties

NameTypeDescription
scope
CustomFunctionScope | undefined

The scope of the function.

  • 'field': Function only uses fieldValue (no cross-field dependencies). Use this when your function only reads the current field's value.
  • 'form': Function may use formValue (has cross-field dependencies). This is the default, and ensures proper reactivity when accessing other fields in the form.

@default 'form'

Example usage
// Field-only function - only uses the current field value
registry.registerCustomFunction('isEmpty', (ctx) => !ctx.fieldValue, { scope: 'field' });

// Form-level function - accesses other fields (default)
registry.registerCustomFunction('isAdult', (ctx) => ctx.formValue.age >= 18);