Dialog Schema

The dialog schema defines the configurable properties of a component. This guide covers all field types, validation, and best practices.

Schema Structure

The dialog.json file defines the component's configurable properties:

{

  "schemaVersion": "1.0",

  "fields": [

    {

      "type": "text",

      "name": "heading",

      "label": "Heading",

      "required": true,

      "defaultValue": "Welcome"

    }

  ]

}

Top-level properties:

  • schemaVersion: Schema version (currently "1.0")
  • fields: Array of field definitions

Field Types

Text Field

Single-line text input:

{

  "type": "text",

  "name": "title",

  "label": "Title",

  "required": true,

  "defaultValue": "Untitled",

  "placeholder": "Enter a title",

  "maxLength": 100

}

Properties:

  • type: "text"
  • name: Unique field identifier (used in template markers)
  • label: Display label shown to users
  • required: true or false
  • defaultValue: Default value (optional)
  • placeholder: Placeholder text (optional)
  • maxLength: Maximum character count (optional)

Use cases: Titles, names, short labels

Textarea Field

Multi-line text input:

{

  "type": "textarea",

  "name": "description",

  "label": "Description",

  "required": false,

  "defaultValue": "",

  "placeholder": "Enter a description",

  "rows": 5,

  "maxLength": 500

}

Properties:

  • type: "textarea"
  • rows: Number of visible rows (optional, default: 3)
  • maxLength: Maximum character count (optional)

Use cases: Descriptions, summaries, multi-line content

Rich Text Field

WYSIWYG editor for formatted text:

{

  "type": "richtext",

  "name": "content",

  "label": "Content",

  "required": true,

  "defaultValue": "<p>Enter your content here</p>",

  "toolbar": ["bold", "italic", "link", "heading"]

}

Properties:

  • type: "richtext"
  • toolbar: Array of enabled toolbar buttons (optional)

Toolbar options:

  • bold, italic, underline, strikethrough
  • heading, paragraph, blockquote
  • link, unlink
  • bulletList, orderedList
  • undo, redo

Use cases: Article content, formatted descriptions, blog posts

Number Field

Numeric input:

{

  "type": "number",

  "name": "count",

  "label": "Item Count",

  "required": true,

  "defaultValue": 3,

  "min": 1,

  "max": 10,

  "step": 1

}

Properties:

  • type: "number"
  • min: Minimum value (optional)
  • max: Maximum value (optional)
  • step: Increment step (optional, default: 1)

Use cases: Counts, quantities, numeric settings

Boolean Field

Checkbox for true/false values:

{

  "type": "boolean",

  "name": "showImage",

  "label": "Show Image",

  "required": false,

  "defaultValue": true

}

Properties:

  • type: "boolean"
  • defaultValue: true or false

Use cases: Feature toggles, visibility flags

Select Field

Dropdown selection:

{

  "type": "select",

  "name": "alignment",

  "label": "Text Alignment",

  "required": true,

  "defaultValue": "left",

  "options": [

    { "value": "left", "label": "Left" },

    { "value": "center", "label": "Center" },

    { "value": "right", "label": "Right" }

  ]

}

Properties:

  • type: "select"
  • options: Array of { value, label } objects

Use cases: Predefined choices, alignment, size options

Image Field

Image upload with alt text:

{

  "type": "image",

  "name": "heroImage",

  "label": "Hero Image",

  "required": true,

  "defaultValue": {

    "src": "",

    "alt": ""

  }

}

Properties:

  • type: "image"
  • defaultValue: Object with src and alt properties

Value format: The field value is stored as JSON:

{

  "src": "https://example.com/image.jpg",

  "alt": "Description of image"

}

In templates: Access as {{heroImage.src}} and {{heroImage.alt}}

Use cases: Images, photos, graphics

Page Link Field

Link to another page in the site:

{

  "type": "pageLink",

  "name": "relatedPage",

  "label": "Related Page",

  "required": false,

  "defaultValue": ""

}

Properties:

  • type: "pageLink"

Value format: The field value is a page slug (e.g., /about)

Use cases: Internal links, related content, navigation

Field Validation

Required Fields

Required fields must have a non-empty value:

{

  "type": "text",

  "name": "title",

  "label": "Title",

  "required": true

}

Users cannot save the component without filling required fields.

Default Values

Default values are used when the field is first added:

{

  "type": "text",

  "name": "buttonText",

  "label": "Button Text",

  "required": false,

  "defaultValue": "Learn More"

}

Best practices:

  • Provide sensible defaults for optional fields
  • Use empty string "" for text fields with no default
  • Use false for boolean fields that default to off

Max Length

Limit text field length:

{

  "type": "text",

  "name": "title",

  "label": "Title",

  "maxLength": 60

}

Users see a character counter and cannot exceed the limit.

Min/Max for Numbers

Constrain numeric values:

{

  "type": "number",

  "name": "columns",

  "label": "Number of Columns",

  "min": 1,

  "max": 4,

  "defaultValue": 3

}

Conditional Fields

Show fields conditionally based on other field values:

{

  "fields": [

    {

      "type": "boolean",

      "name": "showButton",

      "label": "Show Button",

      "defaultValue": false

    },

    {

      "type": "text",

      "name": "buttonText",

      "label": "Button Text",

      "required": false,

      "defaultValue": "Click Here",

      "showIf": {

        "field": "showButton",

        "equals": true

      }

    }

  ]

}

Properties:

  • showIf.field: Name of the field to check
  • showIf.equals: Value that triggers visibility

Behavior:

  • Field is hidden when condition is not met
  • Field value is preserved when hidden
  • Required validation only applies when field is visible

Field Groups

Organize related fields visually:

{

  "schemaVersion": "1.0",

  "fieldGroups": [

    {

      "label": "Content",

      "fields": [

        {

          "type": "text",

          "name": "heading",

          "label": "Heading",

          "required": true

        },

        {

          "type": "textarea",

          "name": "description",

          "label": "Description",

          "required": false

        }

      ]

    },

    {

      "label": "Styling",

      "fields": [

        {

          "type": "select",

          "name": "theme",

          "label": "Theme",

          "required": true,

          "options": [

            { "value": "light", "label": "Light" },

            { "value": "dark", "label": "Dark" }

          ]

        }

      ]

    }

  ]

}

Note: Use either fields (flat list) or fieldGroups (grouped), not both.

Schema Validation

The CMS validates dialog schemas on upload:

Required Properties

  • schemaVersion must be present and equal to "1.0"
  • fields or fieldGroups must be present
  • Each field must have type, name, and label

Field Names

  • Must be unique within the schema
  • Must contain only alphanumeric characters and underscores
  • Must start with a letter
  • Cannot be empty

Valid: heading, button_text, showImage Invalid: 123heading, button-text, show image

Field Types

  • Must be one of: text, textarea, richtext, number, boolean, select, asset, icon, image, page-link
  • Unknown types are rejected
Notes:
  • asset — a single image chosen from the asset library (DAM) or uploaded. The editor shows a thumbnail with a select/upload button; the stored value is the image URL string (use it directly in the template, e.g. {{src}}).
  • icon — a single Font Awesome icon chosen from a picker that browses the full Font Awesome Free catalogue (search by name or synonym, filter by solid/regular/brands). The stored value is the icon's class pair, e.g. fa-solid fa-star; render it directly in the template with <i class="{{fieldName}}" aria-hidden="true"></i>. The published page loads the Font Awesome stylesheet automatically when it contains at least one icon.
  • page-link — a link destination (also accepts the alias link). The editor lets the author type a URL, click Page to browse the site's page tree and link to an internal page (stored as /path), or click Asset to browse the asset store and link to any uploaded asset — images, PDFs, documents, etc. (stored as the asset URL, e.g. /assets/docs/cv.pdf).

Select Options

  • select fields must have an options array
  • Each option must have value and label properties
  • At least one option is required

Image Default Values

  • image fields must have defaultValue as an object with src and alt properties
  • Both properties must be strings (can be empty)

Best Practices

Field Design

  • Clear labels: Use descriptive, user-friendly labels
  • Helpful placeholders: Provide examples in placeholders
  • Logical order: Order fields in a natural sequence
  • Group related fields: Use field groups for complex components

Validation

  • Mark required fields: Only mark truly required fields
  • Set reasonable limits: Use maxLength, min, max appropriately
  • Provide defaults: Set sensible defaults for optional fields
  • Test validation: Try invalid inputs to verify validation works

Conditional Fields

  • Keep it simple: Avoid complex conditional logic
  • Test thoroughly: Verify conditional fields show/hide correctly
  • Document behavior: Explain conditional logic in field labels or descriptions

Performance

  • Limit rich text: Rich text fields are heavier than plain text
  • Optimize images: Encourage users to upload optimized images
  • Avoid too many fields: Keep dialogs focused and manageable

Example: Complete Dialog Schema

{

  "schemaVersion": "1.0",

  "fieldGroups": [

    {

      "label": "Content",

      "fields": [

        {

          "type": "text",

          "name": "heading",

          "label": "Heading",

          "required": true,

          "maxLength": 100,

          "placeholder": "Enter a heading"

        },

        {

          "type": "textarea",

          "name": "description",

          "label": "Description",

          "required": false,

          "rows": 3,

          "maxLength": 300,

          "placeholder": "Enter a description"

        },

        {

          "type": "image",

          "name": "image",

          "label": "Image",

          "required": true,

          "defaultValue": {

            "src": "",

            "alt": ""

          }

        }

      ]

    },

    {

      "label": "Call to Action",

      "fields": [

        {

          "type": "boolean",

          "name": "showButton",

          "label": "Show Button",

          "defaultValue": false

        },

        {

          "type": "text",

          "name": "buttonText",

          "label": "Button Text",

          "required": false,

          "defaultValue": "Learn More",

          "maxLength": 30,

          "showIf": {

            "field": "showButton",

            "equals": true

          }

        },

        {

          "type": "pageLink",

          "name": "buttonLink",

          "label": "Button Link",

          "required": false,

          "showIf": {

            "field": "showButton",

            "equals": true

          }

        }

      ]

    },

    {

      "label": "Styling",

      "fields": [

        {

          "type": "select",

          "name": "alignment",

          "label": "Text Alignment",

          "required": true,

          "defaultValue": "center",

          "options": [

            { "value": "left", "label": "Left" },

            { "value": "center", "label": "Center" },

            { "value": "right", "label": "Right" }

          ]

        }

      ]

    }

  ]

}

Related Topics