Markdown Text
type: "markdown"
A text formatted as Markdown, shown between the fields. Use it to explain how fields work together, to point to further information, or to warn about a combination of settings. A markdown text isn't a field and has no value.
Properties
| Property | Type | Restrictions | Description |
|---|---|---|---|
| type | string | Required | Always markdown. |
| text | string | Required | The text to show, formatted as Markdown. |
| variant | string | info or warning | Highlights the text as an info (with an info icon) or a warning. Without it, the text is shown on a plain surface. |
| name | string | Pattern: ^[\w-]+$ | Only within the config array: needed to place the text in a layout by its name. |
| visibleIf | Condition | - | Only shows the text while the condition passes. |
| hideIf | Condition | - | Hides the text while the condition passes. |
Placement
A markdown text can be used in two places:
- In the
configarray, between the fields. Without alayout, it's shown where it's defined. With alayout, give it anameand put the name into the layout like the name of a field. A markdown text without anamein theconfigarray isn't shown when the widget has a layout. - In the
layout, as a layout element, like a separator. It doesn't need anamethere.
The config of a repeater field can contain markdown texts as well.
Example
A warning that only shows while the user picked a fast update interval, placed by name in a fieldset, and a hint placed directly in the layout:
mobro-widget-config.json
{
"config": [
{
"name": "interval",
"label": "Update interval (ms)",
"type": "number",
"defaultValue": 1000
},
{
"name": "interval_warning",
"type": "markdown",
"variant": "warning",
"text": "Intervals below **250 ms** can slow down the dashboard on older devices.",
"visibleIf": {"field": "interval", "lt": 250}
}
],
"layout": [
{
"type": "markdown",
"variant": "info",
"text": "Pick a metric first, the other settings adapt to its type. See the [documentation](https://example.com/my-widget) for details."
},
{
"type": "fieldset",
"label": "Updates",
"children": ["interval", "interval_warning"]
}
]
}
tip
Keep the texts short. The settings sidebar is narrow, and a few lines of text push the fields below out of view.