Bricks Schema 中文文档:element

📄 原始资料  |  展开查看原始 JSON(element.json){ “type”: “object”, “description”: “A Bricks element as stored in any content area (header, content, footer)”, “properties”: { “id”: { “type”: “string”, “description”: “Unique element identifier (6-character alphanumeric)”, “pattern”: “^[a-z0-9]{6}$”, “d…

📄 原始资料  |  展开查看原始 JSON(element.json)
{
  "type": "object",
  "description": "A Bricks element as stored in any content area (header, content, footer)",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique element identifier (6-character alphanumeric)",
      "pattern": "^[a-z0-9]{6}$",
      "descriptionZh": "元素的唯一标识符(6 位字母数字)。"
    },
    "name": {
      "type": "string",
      "description": "Element type (matches the element schema filename, e.g. \"button\", \"heading\")",
      "descriptionZh": "元素类型(与元素 schema 文件名匹配,例如 \"button\"、\"heading\")。"
    },
    "parent": {
      "type": [
        "string",
        "integer"
      ],
      "description": "Parent element ID, or 0 for root-level elements",
      "descriptionZh": "父元素 ID,根级元素为 0。"
    },
    "children": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Ordered array of child element IDs",
      "descriptionZh": "子元素 ID 的有序数组。"
    },
    "settings": {
      "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys."
    },
    "selectors": {
      "type": "array",
      "description": "Custom CSS selectors with scoped settings (since Bricks 2.0)",
      "items": {
        "type": "object",
        "description": "Custom CSS selector on an element or global class (since Bricks 2.0). Allows scoping control settings to arbitrary CSS selectors.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for this selector entry",
            "descriptionZh": "此选择器条目的唯一标识符。"
          },
          "selector": {
            "type": "string",
            "description": "CSS selector string (e.g. \".my-class\", \"&::before\", \"& > span\")",
            "descriptionZh": "CSS 选择器字符串(例如 \".my-class\"、\"&::before\"、\"& > span\")。"
          },
          "settings": {
            "description": "Control settings scoped to this selector (same shape as element settings)",
            "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys.",
            "descriptionZh": "作用域限定到此选择器的控件设置(结构与元素设置相同)。"
          },
          "label": {
            "type": "string",
            "description": "Optional display label for this selector in the builder UI",
            "descriptionZh": "此选择器在构建器 UI 中的可选显示标签。"
          }
        },
        "required": [
          "id",
          "selector",
          "settings"
        ],
        "additionalProperties": false,
        "descriptionZh": "元素或全局类上的自定义 CSS 选择器(Bricks 2.0 起)。允许将控件设置作用域限定到任意 CSS 选择器。"
      },
      "descriptionZh": "带作用域设置的自定义 CSS 选择器(Bricks 2.0 起)。"
    },
    "label": {
      "type": "string",
      "description": "Optional custom label assigned by the user",
      "descriptionZh": "用户分配的可选自定义标签。"
    },
    "themeStyles": {
      "type": "array",
      "description": "Theme style overrides applied to this element",
      "descriptionZh": "应用于此元素的主题样式覆盖。"
    }
  },
  "required": [
    "id",
    "name",
    "parent",
    "children",
    "settings"
  ],
  "additionalProperties": false,
  "descriptionZh": "存储在任何内容区域(页头、内容、页脚)中的 Bricks 元素。"
}

前言

存储在任何内容区域(页头、内容、页脚)中的 Bricks 元素。

基本信息

  • 类型object

属性

  • id (string):元素的唯一标识符(6 位字母数字)。
  • name (string):元素类型(与元素 schema 文件名匹配,例如 “button”、”heading”)。
  • parent (["string", "integer"]):父元素 ID,根级元素为 0。
  • children (array):子元素 ID 的有序数组。
  • settings
  • selectors (array):带作用域设置的自定义 CSS 选择器(Bricks 2.0 起)。
  • label (string):用户分配的可选自定义标签。
  • themeStyles (array):应用于此元素的主题样式覆盖。

Schema 定义

完整 JSON 定义

{
  "type": "object",
  "description": "A Bricks element as stored in any content area (header, content, footer)",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique element identifier (6-character alphanumeric)",
      "pattern": "^[a-z0-9]{6}$",
      "descriptionZh": "元素的唯一标识符(6 位字母数字)。"
    },
    "name": {
      "type": "string",
      "description": "Element type (matches the element schema filename, e.g. \"button\", \"heading\")",
      "descriptionZh": "元素类型(与元素 schema 文件名匹配,例如 \"button\"、\"heading\")。"
    },
    "parent": {
      "type": [
        "string",
        "integer"
      ],
      "description": "Parent element ID, or 0 for root-level elements",
      "descriptionZh": "父元素 ID,根级元素为 0。"
    },
    "children": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Ordered array of child element IDs",
      "descriptionZh": "子元素 ID 的有序数组。"
    },
    "settings": {
      "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys."
    },
    "selectors": {
      "type": "array",
      "description": "Custom CSS selectors with scoped settings (since Bricks 2.0)",
      "items": {
        "type": "object",
        "description": "Custom CSS selector on an element or global class (since Bricks 2.0). Allows scoping control settings to arbitrary CSS selectors.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for this selector entry",
            "descriptionZh": "此选择器条目的唯一标识符。"
          },
          "selector": {
            "type": "string",
            "description": "CSS selector string (e.g. \".my-class\", \"&::before\", \"& > span\")",
            "descriptionZh": "CSS 选择器字符串(例如 \".my-class\"、\"&::before\"、\"& > span\")。"
          },
          "settings": {
            "description": "Control settings scoped to this selector (same shape as element settings)",
            "_note": "Dynamic map of all settings for this element or class. Keys are element-specific control names (e.g. `text`, `style`) or inherited CSS setting keys, optionally suffixed with a breakpoint and/or pseudo-class using colon syntax (e.g. `_typography:tablet_portrait:hover`). See the individual element schemas for available control keys.",
            "descriptionZh": "作用域限定到此选择器的控件设置(结构与元素设置相同)。"
          },
          "label": {
            "type": "string",
            "description": "Optional display label for this selector in the builder UI",
            "descriptionZh": "此选择器在构建器 UI 中的可选显示标签。"
          }
        },
        "required": [
          "id",
          "selector",
          "settings"
        ],
        "additionalProperties": false,
        "descriptionZh": "元素或全局类上的自定义 CSS 选择器(Bricks 2.0 起)。允许将控件设置作用域限定到任意 CSS 选择器。"
      },
      "descriptionZh": "带作用域设置的自定义 CSS 选择器(Bricks 2.0 起)。"
    },
    "label": {
      "type": "string",
      "description": "Optional custom label assigned by the user",
      "descriptionZh": "用户分配的可选自定义标签。"
    },
    "themeStyles": {
      "type": "array",
      "description": "Theme style overrides applied to this element",
      "descriptionZh": "应用于此元素的主题样式覆盖。"
    }
  },
  "required": [
    "id",
    "name",
    "parent",
    "children",
    "settings"
  ],
  "additionalProperties": false,
  "descriptionZh": "存储在任何内容区域(页头、内容、页脚)中的 Bricks 元素。"
}

补充说明

更多细节可参考 Bricks 官方 Academy 文档