Bricks Schema 中文文档:开关

📄 原始资料 (已截断)  |  展开查看原始 JSON(toggle.json){ “$schema”: “https://json-schema.org/draft/2020-12/schema”, “$id”: “bricks://elements/toggle”, “schemaVersion”: “2.3”, “type”: “object”, “title”: “Toggle”, “description”: “Schema for Bricks Toggle element”, “metadata”: { “name”: “toggle”, “category…

📄 原始资料 (已截断)  |  展开查看原始 JSON(toggle.json)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "bricks://elements/toggle",
  "schemaVersion": "2.3",
  "type": "object",
  "title": "Toggle",
  "description": "Schema for Bricks Toggle element",
  "metadata": {
    "name": "toggle",
    "category": "general",
    "tag": "div",
    "nestable": false
  },
  "settings": {
    "icon": {
      "label": "Icon",
      "valueSchema": {
        "type": "object",
        "description": "Icon settings",
        "properties": {
          "library": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "svg": {
            "type": "object"
          }
        },
        "descriptionZh": "图标设置。"
      },
      "controlType": "icon",
      "labelZh": "图标"
    },
    "iconColor": {
      "label": "Color",
      "css": [
        {
          "property": "color"
        },
        {
          "property": "fill"
        }
      ],
      "hasRequired": true,
      "valueSchema": {
        "description": "Color value in various formats",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "hex": {
                "type": "string",
                "pattern": "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
              }
            },
            "required": [
              "hex"
            ]
          },
          {
            "type": "object",
            "properties": {
              "rgb": {
                "type": "string",
                "pattern": "^rgba?\\("
              }
            },
            "required": [
              "rgb"
            ]
          },
          {
            "type": "object",
            "properties": {
              "hsl": {
                "type": "string",
                "pattern": "^hsla?\\("
              }
            },
            "required": [
              "hsl"
            ]
          },
          {
            "type": "object",
            "properties": {
              "raw": {
                "type": "string",
                "description": "Raw color value or CSS variable",
                "descriptionZh": "原始颜色值或 CSS 变量。"
              }
            },
            "required": [
              "raw"
            ]
          }
        ],
        "descriptionZh": "各种格式的颜色值。"
      },
      "controlType": "color",
      "labelZh": "颜色"
    },
    "iconSize": {
      "label": "Size",
      "units": true,
      "css": [
        {
          "property": "font-size"
        }
      ],
      "hasRequired": true,
      "valueSchema": {
        "oneOf": [
          {
            "type": "string",
            "description": "Value with unit (e.g., \"10px\", \"50%\")",
            "descriptionZh": "带单位的值(例如 \"10px\"、\"50%\")。"
          },
          {
            "type": "number"
          }
        ]
      },
      "controlType": "number",
      "labelZh": "尺寸"
    },
    "animation": {
      "label": "Animation",
      "options": {
        "boring": "close (x)",
        "arrow": "arrow (<-)",
        "arrow-r": "arrow-r (->)",
        "arrowalt": "arrowalt",
        "arrowalt-r": "arrowalt-r",
        "arrowturn": "arrowturn",
        "arrowturn-r": "arrowturn-r",
        "minus": "minus (-)",
        "spin": "spin",
        "spring": "spring",
        "squeeze": "squeeze",
        "vortex": "vortex",
        "boringZh": "关闭 (×)",
        "arrowZh": "箭头 (←)",
        "arrow-rZh": "箭头 (→)",
        "minusZh": "减号 (-)"
      },
      "hasRequired": true,
      "valueSchema": {
        "oneOf": [
          {
            "type": "string",
            "description": "Single selection",
            "descriptionZh": "单选。"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Multiple selection",
            "descriptionZh": "多选。"
          }
        ]
      },
      "controlType": "select",
      "labelZh": "动画"
    },
    "ariaLabel": {
      "label": "aria-label",
      "valueSchema": {
        "type": "string"
      },
      "controlType": "text",
      "labelZh": "aria-label"
    },
    "toggleSelector": {
      "label": "CSS selector",
      "valueSchema": {
        "type": "string"
      },
      "controlType": "text",
      "labelZh": "CSS 选择器"
    },
    "toggleAttribute": {
      "label": "Attribute",
      "valueSchema": {
        "type": "string"
      },
      "controlType": "text",
      "labelZh": "属性"
    },
    "toggleValue": {
      "label": "Value",
      "valueSchema": {
        "type": "string"
      },
      "controlType": "text",
      "labelZh": "值"
    },
    "barScale": {
      "label": "Scale",
      "css": [
        {
          "property": "--brxe-toggle-scale"
        }
      ],
      "hasRequired": true,
      "valueSchema": {
        "oneOf": [
          {
            "type": "string",
            "description": "Value with unit (e.g., \"10px\", \"50%\")",
            "descriptionZh": "带单位的值(例如 \"10px\"、\"50%\")。"
          },
          {
            "type": "number"
          }
        ]
      },
      "controlType": "number",
      "labelZh": "缩放"
    },
    "barHeight": {
      "label": "Height",
      "units": true,
      "css": [
        {
          "property": "--brxe-toggle-bar-height",
          "selector": ".brxa-inner"
        }
      ],
      "hasRequired": true,
      "valueSchema": {
        "oneOf": [
          {
            "type": "string",
            "description": "Value with unit (e.g., \"10px\", \"50%\")",
            "descriptionZh": "带单位的值(例如 \"10px\"、\"50%\")。"
          },
          {
            "type": "number"
          }
        ]
      },
      "controlType": "number",
      "labelZh": "高度"
    },
    "barRadius": {
      "label": "Radius",
      "units": true,
      "css": [
        {
          "property": "--brxe-toggle-bar-radius",
          "selector": ".brxa-inner"
        }
      ],
      "hasRequired": true,
      "valueSchema": {
        "oneOf": [
          {
            "type": "string",
            "description": "Value with unit (e.g., \"10px\", \"50%\")",
            "descriptionZh": "带单位的值(例如 \"10px\"、\"50%\")。"
          },
          {
            "type": "number"
          }
        ]
      },
      "controlType": "number",
      "labelZh": "圆角"
    },
    "barColor": {
      "label": "Color",
      "css": [
        {
          "property": "color",
          "selector": ".brxa-wrap"
        }
      ],
      "hasRequired": true,
      "valueSchema": {
        "description": "Color value in various formats",
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "hex": {
                "type": "string",
                "pattern": "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
              }
            },
            "required": [
              "hex"
            ]
          },
          {
            "type": "object",
            "properties": {
              "rgb": {
                "type": "string",
                "pattern": "^rgba?\\("
              }
            },
            "required": [
              "rgb"
            ]
          },
          {
            "type": "object",
            "properties": {
              "hsl": {
                "type": "string",
                "pattern": "^hsla?\\("
              }
            },
            "required": [
              "hsl"
            ]
          },
          {
            "type": "object",
            "properties": {
              "raw": {
                "type": "string",
                "description": "Raw color value or CSS variable",
                "descriptionZh": "原始颜色值或 CSS 变量。"
              }
            },
            "required": [
              "raw"
            ]
          }
        ],
        "descriptionZh": "各种格式的颜色值。"
      },
      "controlType": "color",
      "labelZh": "颜色"
    },
    "_content": {
      "label": "Content",
      "css": [
        {
          "property": "content

... (内容过长已截断,完整 JSON 见原始文件)

前言

Bricks Toggle 元素的 schema。

基本信息

  • 英文名称Toggle
  • 中文名称:开关
  • Schema IDbricks://elements/toggle
  • Schema 版本2.3
  • 类型object
  • 分类general
  • Tagdiv
  • 内部名称toggle

设置项

  • icon — 图标 (icon)
  • iconColor — 颜色 (color)
  • iconSize — 尺寸 (number)
  • animation — 动画 (select)
  • ariaLabel — aria-label (text)
  • toggleSelector — CSS 选择器 (text)
  • toggleAttribute — 属性 (text)
  • toggleValue — 值 (text)
  • barScale — 缩放 (number)
  • barHeight — 高度 (number)
  • barRadius — 圆角 (number)
  • barColor — 颜色 (color)
  • _content — 内容 (text)
  • _margin — 外边距 (spacing)
  • _padding — 内边距 (spacing)
  • _width — 宽度 (number)
  • _widthMin — 最小宽度 (number)
  • _widthMax — 最大宽度 (number)
  • _height — 高度 (number)
  • _heightMin — 最小高度 (number)
  • _heightMax — 最大高度 (number)
  • _aspectRatio — 宽高比 (text)
  • _position — 位置 (select)
  • _top — 顶部 (number)
  • _right — 右侧 (number)
  • _bottom — 底部 (number)
  • _left — 左侧 (number)
  • _zIndex — Z 索引 (number)
  • _order — 顺序 (number)
  • _display — 显示 (select)
  • _visibility — 可见性 (select)
  • _overflow — 溢出 (text)
  • _opacity — 不透明度 (number)
  • _cursor — 光标 (select)
  • _isolation — 隔离 (select)
  • _mixBlendMode — 混合模式 (select)
  • _pointerEvents — 指针事件 (text)
  • _perspective — 透视 (number)
  • _perspectiveOrigin — 透视原点 (text)
  • _gridItemJustifySelf — 自身水平对齐 (align-items)
  • _flexDirection — 方向 (direction)
  • _alignSelf — 自身对齐 (align-items)
  • _justifyContent — 主轴对齐 (justify-content)
  • _alignItems — 交叉轴对齐 (align-items)
  • _gap — 间距 (number)
  • _flexGrow — 放大比例 (number)
  • _flexShrink — 缩小比例 (number)
  • _flexBasis — 伸缩基准 (text)
  • _useMasonry — %s 布局 (checkbox)
  • _masonryColumn — 列数 (number)
  • _masonryGutter — 间距 (number)
  • _masonryHorizontalOrder — 水平顺序 (checkbox)
  • _masonryTransitionDuration — 过渡 (number)
  • _masonryTransitionMode — 显现动画 (select)
  • _typography — _typography (typography)
  • _background — _background (background)
  • _shapeDividers — 自定义形状 (repeater)
  • _gradient — _gradient (gradient)
  • _border — 边框 (border)
  • _boxShadow — 盒子阴影 (box-shadow)
  • _transform — 变换 (transform)
  • _transformOrigin — 变换原点 (text)
  • _motionElementParallax — 元素视差 (checkbox)
  • _motionElementParallaxSpeedX — 水平速度 (number)
  • _motionElementParallaxSpeedY — 垂直速度 (number)
  • _motionBackgroundParallax — 背景视差 (checkbox)
  • _motionBackgroundParallaxSpeed — 背景速度 (number)
  • _motionStartVisiblePercent — 视差起点 (number)
  • _cssCustom — 自定义 CSS (code)
  • _cssClasses — CSS 类 (text)
  • _cssId — CSS ID (text)
  • _cssFilters — CSS 滤镜 (filters)
  • _cssTransition — 过渡 (text)
  • _attributes — 姓名 (repeater)
  • _scrollSnapType — 类型 (select)
  • _scrollSnapAlign — 对齐 (select)
  • _scrollSnapStop — 停止 (select)

补充说明

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