Single Choice
WdRadioList
Applicable Scenarios
The page displays options in a tiled layout, allowing users to make a single selection.
Basic Capabilities Description
Single selection can be bound to text fields in the data model. When the form is submitted, the selected value of the single selection will be submitted to the data model. Each option's name and value can be configured. The default selected value can be configured (when configuring, enter the option value, not the option name). The component size can be selected (effective on PC, not on mobile).
Supports personalized configuration for titles, including title content, alignment, whether to wrap text (when enabled, the title wraps to the next line if it exceeds one line; when disabled, the title is truncated if it exceeds one line), title position, width, and tooltip text.

- Supports personalized configuration of options, including the tooltip below options, layout direction, and whether to display underlines on mobile devices.

Note:
- The radio component supports both horizontal and vertical layout directions for options, with vertical as the default. When horizontal is selected, options will automatically wrap based on their length.
- If a component is within a form container, its size, title alignment, position, line wrapping, and width will default to the property configuration of the form container
To learn more about form component usage scenarios, refer to the Form Common Scenario Practice Guide
Extended Scenarios Description
Generating Dynamic Option Lists via Query
Using class data as an example, configure a dynamic option list for the component.
Create a class data model with a class name field.

In the Data Management Backend, enter sample values for several classes in this model (note the data environment in the top-left corner of the backend: trial data is only available in the editor development preview and trial version applications; for production applications, formal data must be entered in advance)

In the code area at the bottom left of the editor, click the '+' to create a new WeDa data table query. After completing the configuration below, click the save button in the top right corner.
Data table: select the previously created class model.
Trigger Method: Select to automatically execute when input parameters change (executes automatically once upon page load to retrieve relevant data)
Filter conditions, sorting methods: Can be configured as needed or left blank

Click the data binding mode button "fx" on the right of the component options properties to open the expression input.
$w.query1.data.records.map((item) => {
return {
value: value: item._id, // use the data ID as the option value
label: label: item.bjmc, // use the class name as the label displayed for the option
};
});
Achieving Non-Cancellable Selection via Styling
.wd-radio-wrap.is-checked {
pointer-events: none;
}
- After completing the above configuration, the component's option list can load and display data from the data model, achieving dynamic control of the option list.
Example
Interactive Preview
Different Types of Single Select
Style API Custom Styles
#wd-page-root .wd-form-item .wd-radio-wrap.radio1 .wd-radio-label {
color: green;
}
#wd-page-root .wd-form-item .wd-radio-wrap.radio2 .wd-radio-label {
color: red;
}
Properties
External properties received by the component
Property Name | Property Identifier | Type | Description |
|---|
| Display Headlines | labelVisible | boolean | Default value: true |
| Title alignment | labelAlign | string | In the scenario, the form by default follows the title alignment configuration of the form container. |
| Line break in heading | labelWrap | boolean | If the title content is too long when closed, show one line with overflow omitted; when enabled, show with line breaks. In form scenarios, it follows the form container's title line break configuration by default. |
| Title position | layout | string | Set title display position in form component. In the scenario, it follows the title position configuration of the form container by default. |
| Title width | labelWidth | string | In the scenario, the form follows the title width configuration of the form container by default. |
| Heading Note | labelTips | string | Configure tooltip content for the heading |
| Prompt. | extra | string | Prompt content is displayed below the component after configuration. |
| Orientation | direction | string | Example: "vertical" |
| Display underscore on mobile terminal | borderedH5 | boolean | After closing, the mobile terminal does not show the bottom underline Example: true |
| Status. | status | string | Example: "edit" |
| Required | required | boolean | Enable required for this component, value cannot be empty Example: false |
| Required identifier | requiredFlag | boolean | Enabled, the component will display a required asterisk tag if mandatory. Example: true |
| Required validation note | requiredMsg | string | Enable required, prompting message when component value is empty Example: "该项为必填项" |
| Bound field | name | string | The Key value of a form field is used to match the field identifier of the data model when submitting data. It must be unique within the form. |
| Title content. | label | string | Example: "标题" |
| Option | range | array | Option List Example: [ { "label": "选项1", "value": "1" }, { "label": "选项2", "value": "2" } ] |
| selected value | value | string | Default selected option Example: "" |
| Component size(PC) | size | string | Single-selection component dimension width, takes effect on PC only Example: "" |
| Option | tipBlock | string | Example: "" |
Events
Events exposed by the component. You can listen to component events to trigger external actions
Event Name | Event Code | Event Output Parameters event.detail | Applicable Scenarios | Description |
|---|
| value change | change | object
| Compatible with all platforms | - |
Properties API
Through the Property API, you can access the internal state and property values of components. You can access internal values using$w.componentId.propertyName, such as $w.input1.value. For details, please refer to Property API
Read-only Property Name | Property Identifier | Type | Description |
|---|
| Bound field | name | string | The Key value of a form field is used to match the field identifier of the data model when submitting data. It must be unique within the form. |
| Title content. | label | string | |
| selected value | value | string | Default selected option |
| Required | required | boolean | Enable required for this component, value cannot be empty |
| Indicates whether to display | visible | boolean | Whether to display the component |
| Whether to disable | disabled | boolean | Component Disabled |
| Specify whether it is read-only or not. | readOnly | boolean | Whether the component is read-only |
| Select Item Name | selectedLabel | string | Selected Item Text Name |
| selected item | item | object | selected item object |
Method API
Through the Method API, you can programmatically trigger internal methods of components, such as submitting forms, displaying popups, etc. You can call component methods using $w.componentId.methodName, such as $w.form1.submit()
Method Name | Method Identifier | Parameters | Method Description |
|---|
| set value | setValue | string值 | 通过 $w.id1.setValue("weda") 设置组件值 |
| Show/Hide Settings | setVisible | boolean显示 | Set the component to hidden via $w.id1.setVisible(false) |
| Set Disabled | setDisabled | boolean禁用 | Set the component to disabled with $w.id1.setDisabled(true) |
| Clear value | clearValue | Clear the component value with $w.id1.clearValue() | |
| Set as read-only | setReadOnly | boolean只读 | Set the component to read-only via $w.id1.setReadOnly(true) |
| Trigger validation | handleValidate | Validate the component value via $w.id1.handleValidate() | |
| Clear verification | clearValidate | Clear component validation via $w.id1.clearValidate() |
Style API
Through the Style API, you can override the styles of internal elements in components to achieve customization. For example, in the low-code editor, you can write styles for all button components using #wd-page-root .wd-btn, and control individual component styles with :scope. For detailed instructions, please refer toStyle API
Name | Class Name | Description and Examples |
|---|
| root element | .wd-radio-root | Outermost component element |
| H5 root element | .wd-h5-radio-root | Settable root element style for the H5 side |
| PC-side root element | .wd-pc-radio-root | Settable root element style for the PC side |
| Mini program root element | .wd-mp-radio-root | Settable root element style for mini program |
| Component title style | .wd-radio-root .wd-form-item-wrap__label | Component title element |
| form control root node style | .wd-radio-root .wd-form-item-wrap__control | Set form control root element style |
| radio button control group root node style | .wd-radio-root .wd-radio-group | radio button control group root node style |
| radio button control single item root node style | .wd-radio-root .wd-radio-wrap | radio button control single item root node style |
| Option style in editing status | .wd-radio-root .wd-radio-label | Option style in editing status |
| Button style in editing status (selected) | .wd-radio-root .is-checked .wd-radio-inner | Button style in editing status (selected) |
| Editing status - Unselected button style | .wd-radio-root :not(.is-checked) .wd-radio-inner | Editing status - Unselected button style |
| Editing status - Button background color | .wd-radio-root .wd-radio-inner | Editing status - Button background color |
| Editing status - Verification information | .wd-radio-root .wd-g-text-error | Set component verification information style |
| prompt text | .wd-radio-root .wd-form-item__help-text | Set the text style of the component prompt |
| Disabled state - Option style | .wd-radio-root .is-disabled .wd-radio-label | Disabled state - Option style |
| Disabled state - Selected button style | .wd-radio-root .is-disabled.is-checked .wd-radio-inner | Disabled state - Selected button style |
| Disabled state - Unselected button style | .wd-radio-root .is-disabled:not(.is-checked) .wd-radio-inner | Disabled state - Unselected button style |
| Disabled - Button background color | .wd-radio-root .is-disabled .wd-radio-inner | Disabled - Button background color |
| read-only status - form value style | .wd-radio-root .wd-form-item__readonly-value | Set component read-only status |
Version Changes
- Property Changes
- Style Changes
- widget api Changes