← Back to Docs
Recipe

Conditional Form Fields

Show or hide form inputs based on user selections. Keep your forms clean and context-aware without writing complex state machines.

Overview

Meridian lets you attach visibility rules to any field. When a trigger field changes, dependent fields appear or disappear instantly — no page reload, no custom JavaScript.

Defining a Rule

In your form schema, add a visibleWhen property to any field. The field renders only when the condition evaluates to true.

{
  "fields": [
    { "name": "plan", "type": "select" },
    {
      "name": "companyName",
      "type": "text",
      "visibleWhen": {
        "field": "plan",
        "equals": "business"
      }
    }
  ]
}

Supported Operators

  • equals — exact string match
  • notEquals — inverted match
  • includes — value is in a list
  • isTruthy — checkbox or toggle is on

Chaining Conditions

Combine multiple rules with allOf or anyOf for complex logic. Nested conditions are evaluated depth-first.

Next: Read the multi-step forms recipe to combine conditional fields with wizard-style navigation.