Skip to main content
Conditional logic is evaluated automatically by @osforms/react as the user fills out the form. Hidden fields are skipped in navigation and excluded from the submission payload.

Types

Only ConditionalLogic is exported. Derive the other two types from it:
The shapes:

Usage in FormField

How the SDK evaluates conditions

Conditions are re-evaluated on every answer. The evaluation helpers are internal; use actions.visibleFields from useFormState to read the result. Evaluation rules:
  • equals / not_equals: string comparison after String(value)
  • contains / not_contains: substring check on the stringified value. For checkboxes (an array of values) this checks the comma-joined list, so use contains rather than equals
  • greater_than / less_than: numeric comparison after Number()
  • is_empty: undefined, null, or "". An empty checkbox array ([]) does not count as empty
  • is_not_empty: any other value
  • match: 'all': every condition must be true (AND)
  • match: 'any': at least one condition must be true (OR)

Accessing visible fields

When using useFormState directly, visibleFields reflects the current set of visible fields after applying all conditional logic:
Hidden fields are automatically filtered out of visibleFields and are not included in the submission payload. For full conditional logic documentation, see Core / Conditional Logic.