Paragraph Schema

Introduction

Schemas are structured definitions that describe the format, rules, and relationships of data within a system. They ensure consistency and validate inputs. In Beefree SDK, the Simple Paragraph Schema defines how paragraphs are displayed within email, page, and popup builders. It provides control over typography, formatting, alignment, and responsive layout. This documentation breaks down the schema's properties, requirements, and usage examples to help you implement and customize paragraph blocks effectively.

Schema Overview

This section summarizes the purpose and key characteristics of the Simple Paragraph Schema.

  • Schema Name: Simple Paragraph

  • Purpose: Defines text paragraphs with formatting options like bold, italic, underline, spacing, and alignment.

  • Related Schemas:

    • definitions.schema.json (for padding definitions)

Structure Definition

Below is the JSON Schema definition and a detailed breakdown of each property.

JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "simple_paragraph.schema.json",
  "title": "Simple Paragraph",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "paragraph"
    },
    "underline": {
      "type": "boolean"
    },
    "italic": {
      "type": "boolean"
    },
    "bold": {
      "type": "boolean"
    },
    "html": {
      "type": "string"
    },
    "text": {
      "type": "string"
    },
    "align": {
      "enum": ["left", "center", "right"]
    },
    "size": {
      "type": "integer",
      "minimum": 1
    },
    "color": {
      "type": "string"
    },
    "linkColor": {
      "type": "string"
    },
    "letter-spacing": {
      "type": "integer",
      "minimum": -99,
      "maximum": 99
    },
    "line-height": {
      "type": "number",
      "minimum": 0.5,
      "maximum": 3,
      "multipleOf": 0.00001
    },
    "direction": {
      "enum": ["ltr", "rtl"]
    },
    "padding-top": {
      "$ref": "definitions.schema.json#/definitions/padding"
    },
    "padding-right": {
      "$ref": "definitions.schema.json#/definitions/padding"
    },
    "padding-bottom": {
      "$ref": "definitions.schema.json#/definitions/padding"
    },
    "padding-left": {
      "$ref": "definitions.schema.json#/definitions/padding"
    },
    "locked": {
      "type": "boolean"
    },
    "customFields": {
      "type": "object"
    }
  }
}

Field Descriptions

The following table lists the field descriptions along with their corresponding data type, whether or not they are mandatory, and their description.

Property
Type
Mandatory
Description

text

string

The text content of the paragraph

htmldeprecated (use text)

string

The text content of the paragraph

underline

boolean

Whether the text is underlined

italic

boolean

Whether the text is italicized

bold

boolean

Whether the text is bold

align

enum

The alignment of the text

size

integer

The size of the text (minimum 1)

color

string

The color of the text

linkColor

string

The color of the links

letter-spacing

integer

The letter spacing (-99 to 99)

line-height

number

The line height (0.5 to 3)

direction

enum

The text direction (ltr, rtl)

padding-top

integer

The top padding (0-60)

padding-right

integer

The right padding (0-60)

padding-bottom

integer

The bottom padding (0-60)

padding-left

integer

The left padding (0-60)

customFields

object

Custom fields for the paragraph

locked

boolean

Whether the module is locked

Note: Not available for Single Content AddOn

Usage Examples

Reference an example of the schema in the following code snippet.

Example Paragraph

{
  "text": "Welcome",
  "underline": true,
  "italic": false,
  "bold": true,
  "html": "<p>Welcome</p>",
  "align": "center",
  "size": 16,
  "color": "#000000",
  "linkColor": "#FF0000",
  "letter-spacing": 1,
  "line-height": 1.5,
  "direction": "ltr",
  "padding-top": 10,
  "padding-right": 10,
  "padding-bottom": 10,
  "padding-left": 10,
  "customFields": {
    "custom1": "value1",
    "custom2": "value2"
  }
}

Additional Considerations

Consider the following when working with the Simple Paragraph Schema in Beefree SDK:

  • Responsiveness: Proper use of alignment and padding ensures optimal rendering across devices.

  • Multilingual Support: Use the direction property to support RTL languages.

  • Extensibility: Use customFields for non-standard properties.

Last updated

Was this helpful?