Configurable Widget Fields
The configurable fields are defined as an array in the mobro-widget-config.json
(
see In depth: Widget Configuration)
These fields of a widget can be configured by the user in the dashboard-builder. The fields must have a unique name within the widget and a type, which defines what type of data is stored in the field. Based on this array of field definitions the dashboard-builder automatically creates a form in the sidebar.
Field Definition
There are multiple different kinds of fields. All of them share these common properties:
Field | Type | Restriction | Description |
---|---|---|---|
type | string | Required. Must be a valid field type. See list below | The type of the field |
name | string | Required. Pattern: ^[\w-]+$ | The name (key) of the field |
label | string | Required. | The visible label of the field |
description | string | - | An optional description of the field |
Example
This would be an example for the mobro-widget-config.json
with two simple configurable fields.
mobro-widget-config.json
{
"name": "my_widget",
"displayName": "My Widget",
"config": [
{
"name": "title",
"label": "Title",
"type": "string"
},
{
"name": "subtitle",
"label": "Subtitle",
"type": "string"
}
]
}