Widget Configuration
Each widget in a widget pack must include a mobro-widget-config.json
file which defines some important metadata. These
config files need to be located in the src/
directory of your widget pack. Other than that there is no special place
they have to be. In our ModBros widget packs, we usually place them
under src/widgets/<widget_name>/mobro-widget-config.json
with
the corresponding component in the same directory.
If this file is missing, MoBro won't be able to locate your widget and it will not show up in the app.
Fields
Name | Restrictions | Description |
---|---|---|
name | Required Pattern ^[\w-]+$ Unique within a widget pack | The name (=id) of the widget within the widget pack |
displayName | - | The nice name of the widget. If missing the name will be used |
filename | - | Relative path to the typescript file with the corresponding React component |
config | - | The fields that can be configured by the user in the dashboard builder |
In order to get suggestions for the config files you can add a json schema mapping to your IDE. For Jetbrains IDEs the cli automatically adds those to your project. The MoBro app is able to serve these json schemas locally. Simply add the following two mappings to your IDE to get the correct suggestions:
- files named
mobro-widget-config.json
-> http://localhost:42100/mobro-schema/mobro-widget-config.schema.json - files named
mobro-widget-pack-config.json
-> http://localhost:42100/mobro-schema/mobro-widget-pack-config.schema.json