Skip to main content
The Form block supports two configuration formats: a fields array (used by the visual builder) and a JSON Schema (for advanced use cases). Both are fully supported at runtime.

Basic Example (Fields Array)

The fields array is the primary format produced by the WYSIWYG Builder’s visual form designer.
{
  "type": "form",
  "action_url": "https://api.example.com/submit",
  "submit_text": "Submit",
  "fields": [
    {
      "id": "name",
      "field_type": "text",
      "label": "Name",
      "placeholder": "Enter your name",
      "required": true
    }
  ]
}

Complete Example (Fields Array)

Example Code
[
  {
    "type": "form",
    "action_url": "https://api.example.com/submit-ticket",
    "method": "POST",
    "submit_text": "Submit Ticket",
    "cancel_text": "Cancel",
    "block_id": "support_ticket_form",
    "layout": "stacked",
    "fields": [
      {
        "id": "name",
        "field_type": "text",
        "label": "Full Name",
        "placeholder": "Enter your name",
        "required": true,
        "min_length": 2,
        "max_length": 100
      },
      {
        "id": "email",
        "field_type": "email",
        "label": "Email Address",
        "placeholder": "you@example.com",
        "required": true
      },
      {
        "id": "priority",
        "field_type": "select",
        "label": "Priority",
        "required": true,
        "options": [
          { "label": "Low", "value": "low" },
          { "label": "Medium", "value": "medium" },
          { "label": "High", "value": "high" },
          { "label": "Critical", "value": "critical" }
        ]
      },
      {
        "id": "description",
        "field_type": "textarea",
        "label": "Description",
        "placeholder": "Describe your issue...",
        "required": true
      },
      {
        "id": "agree_to_terms",
        "field_type": "checkbox",
        "label": "I agree to the terms and conditions",
        "required": true
      }
    ]
  }
]

JSON Schema Format (Advanced)

For advanced use cases, you can provide a standard JSON Schema instead of a fields array. The form renderer will use SchemaAutoForm to auto-generate the UI.
{
  "type": "form",
  "action_url": "https://api.example.com/submit",
  "schema": {
    "type": "object",
    "properties": {
      "name": { "type": "string", "title": "Name" },
      "priority": { "type": "string", "title": "Priority", "enum": ["Low", "Medium", "High"] },
      "notes": { "type": "string", "title": "Notes", "uniforms": { "multiline": true } }
    },
    "required": ["name", "priority"]
  }
}

Properties

type
string
required
Identifies this as a form blockMust be form
action_url
string
required
The endpoint URL to POST form data to when submitted
method
string
default:"POST"
required
The HTTP method for the form submissionAllowed values: POST, PUT, PATCH
submit_text
string
default:"Submit"
required
The label text for the submit button
cancel_text
string
required
The label text for an optional cancel button. Leave empty to hide the cancel button.
block_id
string
required
A unique identifier for this form block. Included in the submission payload.
layout
string
default:"stacked"
required
Controls how form fields are arrangedAllowed values: stacked (vertical), columns (side-by-side), inline (horizontal)
fields
array
required
An array of field objects that define the form fields. This is the format produced by the visual builder. Each field has properties like id, field_type, label, placeholder, required, options, etc. See Field Types below.
schema
object
required
A JSON Schema object that defines the form fields. Alternative to fields for advanced use cases. See JSON Schema Field Types below.
model
object
required
Default values for the form fields. Keys should match field IDs (for fields array) or property names (for schema).
{
  "name": "John Doe",
  "priority": "Medium"
}

Field Types (Fields Array)

When using the fields array format, each field object supports the following field_type values:
Field TypeRendered AsNotes
textText inputSingle-line text, supports min_length, max_length, pattern
textareaTextareaMulti-line text input
numberNumber inputNumeric input, supports min, max
emailEmail inputValidates email format
urlURL inputValidates URL format
passwordPassword inputMasked text input
dateDate pickerCalendar selector
selectSelect dropdownRequires options array with { label, value } pairs
radioRadio buttonsRequires options array with { label, value } pairs
checkboxCheckboxBoolean toggle

Field Properties

PropertyTypeDescription
idstringUnique field identifier (used as key in submission payload)
field_typestringOne of the field types above
labelstringDisplay label for the field
placeholderstringPlaceholder text
requiredbooleanWhether the field is required
default_valueanyDefault value
help_textstringHelper text shown below the field
min_lengthnumberMinimum string length (text/textarea/password)
max_lengthnumberMaximum string length (text/textarea/password)
minnumberMinimum value (number)
maxnumberMaximum value (number)
patternstringRegex pattern for validation (text)
optionsarrayOptions for select/radio: [{ "label": "...", "value": "..." }]

Field Types (JSON Schema)

When using the schema format, field types are determined by the JSON Schema type and format:
JSON Schema TypeRendered AsNotes
stringText inputDefault for string types
string + format: "email"Email inputValidates email format
string + format: "uri"URL inputValidates URL format
string + format: "date"Date pickerCalendar selector
string + uniforms.multiline: trueTextareaMulti-line text input
string + enum: [...]Select dropdownOptions from enum values
number / integerNumber inputNumeric input with validation
booleanCheckboxToggle on/off

Submission Payload

When the form is submitted, the following payload is POSTed to the action_url:
{
  "type": "form_submit",
  "block_id": "support_ticket_form",
  "values": {
    "name": "Jason",
    "email": "jason@example.com",
    "priority": "high",
    "description": "Need help with integration",
    "agree_to_terms": true
  }
}

Server Response

The server can respond with the same action types as Button responses:
{
  "action": "replace",
  "blocks": [
    {
      "type": "alert",
      "severity": "success",
      "text": "Ticket #1234 created successfully!"
    }
  ]
}

Nesting Rules

The form block can be placed inside:

Usage Notes

  • The WYSIWYG Builder uses the fields array format with its visual form designer — no JSON editing required
  • When using fields, a JSON Schema is generated internally for rendering via SchemaAutoForm
  • Both fields and schema formats produce identical rendered forms
  • Forms support client-side validation before submission
  • Server-side validation errors can be returned and displayed inline