MenuChevron Down
RadioGroup 单选框组 - Docs - Artefact

RadioGroup 单选框组

Forms
智能自动检测

一组可勾选的按钮,任意时刻只能选中其中一个。

用法

Choose an option

CMS 页面构建器

该组件可作为 radioGroup 区块在 页面构建器content/pages/*.json)中使用:

{
  "type": "radioGroup",
  "label": "Choose an option",
  "items": [
    { "label": "Option A", "value": "a" },
    { "label": "Option B", "value": "b" }
  ]
}

属性

属性类型默认值说明
labelstring-组标签。
itemsRadioGroupItem[]-包含 labelvalue 的项数组。

| orientation | `'horizontal' \ | 'vertical'` | 'vertical' | 布局方向。 |

CMS 配置

- label: RadioGroup
  name: radio-group
  widget: object
  fields:
    - { label: Label, name: label, widget: string, required: false }
    - label: Items
      name: items
      widget: list
      fields:
        - { label: Label, name: label, widget: string }
        - { label: Value, name: value, widget: string }

水合

第 2 级:在提供 valuedefaultValueonValueChange 时进行水合。