Multi-Select Field
type: "multi-select"
A select of predefined options, of which users can pick any number. Use it for choices that aren't exclusive, like which parts of a widget to show.
Additional Properties
| Property | Type | Restrictions | Description |
|---|---|---|---|
| options | ValueOptions | Required | The options users can pick from. |
| defaultValue | string[] | - | The values of the options picked by default. |
Options can show an icon next to their label.
The value of the field is the list of picked values, in the order they were picked. While users haven't touched the
field, the options of the defaultValue are picked. Once users change the selection, it's kept as it is, even if they
remove every option: an empty selection doesn't fall back to the defaultValue. Clearing the field with the clear button
brings the defaultValue back.
Example
{
"config": [
{
"name": "visible_parts",
"label": "Show",
"type": "multi-select",
"defaultValue": ["label", "value"],
"options": [
{"label": "Label", "value": "label", "icon": "md/MdLabel"},
{"label": "Value", "value": "value", "icon": "md/MdNumbers"},
{"label": "Unit", "value": "unit"},
{"label": "Min / Max", "value": "min_max"}
]
}
]
}
Usage
To read the picked values in a widget, use
useMultiSelectField.
To show or hide other fields depending on the picked options, use the includes, includesAny and includesAll checks
of conditional visibility.