Label Selection
WdTagSelect
Applicable Scenarios
Multiple tags are displayed side by side, supporting both single and multiple selection.
Other Scenario Practices
Refer to the Form Scenario Practice Guide to learn about various supported scenarios and implementation solutions for forms.
Making Selection Non-Cancellable via Styles
.wd-tag-item.is-selected {
pointer-events: none;
}
Example
Interactive Preview
Component Input State
Tag Style
Style API Example
#wd-page-root .wd-form-item.wd-tag-select-root .wd-tag-item {
border: 3px solid #0052d950;
}
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. Example: "vertical" |
| 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 | The prompt content is displayed below the input box after configuration. |
| Arrangement mode | direction | string | Default value: "inline" |
| tag type | tagStyleType | string | Example: "light" |
| Selected tag color | tagStyleColor | string | Default value: "#0052d9" |
| Tag rounded corners | tagStyleRadius | string | |
| Mobile terminal tag width | tagStyleWidthType | string | Default is Adaptive Width, valid only in H5/mini program Default value: "flex" |
| Number of tag columns in mobile terminal | tagStyleWidthCols | number | Valid only in H5/Mini Program Example: 4 |
| Tag spacing | tagStyleSpace | string | Default value: "md" |
| Display underscore on mobile terminal | borderedH5 | boolean | After closing, the mobile terminal does not show the bottom underline Default value: true Example: false |
| Status. | status | string | Example: "edit" |
| Required | required | boolean | |
| Required identifier | requiredFlag | boolean | Enabled, the component will display a required asterisk tag if mandatory. Default value: true |
| Required validation note | requiredMsg | string | 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" }, { "label": "标签 3", "value": "3" } ] |
| Selection method | checkType | string | Default value: "checkbox" |
| Default selected tag | value | | Example: [ "1" ] |
| Component size | size | string |
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 | Trigger when a user modifies a component value |
Property 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 | |
| Option | range | array | Option List |
| Default selected tag | value | | |
| Required | required | boolean | |
| 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 | array | 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-tag-select-root | Outermost component element |
| H5 root element | .wd-h5-tag-select-root | Settable root element style for the H5 side |
| PC-side root element | .wd-pc-tag-select-root | Settable root element style for the PC side |
| Mini program root element | .wd-mp-tag-select-root | Settable root element style for mini program |
| Component title style | .wd-tag-select-root .wd-form-item-wrap__label | Component title element |
| form control root node style | .wd-tag-select-root .wd-form-item-wrap__control | Set form control root element style |
| Editing status - Verification information | .wd-tag-select-root .wd-g-text-error | Set component verification information style |
| prompt text | .wd-tag-select-root .wd-form-item__help-text | Set the text style of the component prompt |