Icons
The options of some fields can show an icon. Set the icon of an option to the name of an icon, prefixed with the icon
set it comes from:
{"label": "Home", "value": "home", "icon": "md/MdHome"}
| Field | Where the icon is shown |
|---|---|
select | Next to the label of the option, and in the select while the option is selected. |
multi-select | Next to the label of the option. |
button-group | On the button. A button with an icon and without a label shows only the icon. |
Format
An icon reference has the format <prefix>/<IconName>:
- The prefix names the icon set, see Icon Sets. It's case-insensitive,
MD/MdHomeworks as well. - The icon name is the exact, case-sensitive name of the icon component, e.g.
MdHomeorLineChartIcon.
A reference without a prefix is a Strato icon: LineChartIcon is the same as strato/LineChartIcon.
Icons are loaded on demand: the dashboard builder only loads an icon set once an icon of it is shown. An icon that
can't be found isn't shown, and the option is displayed without it. The developer tools console of the dashboard
builder then shows a warning like Icon "MdHomee" does not exist in "md" or Unknown icon source "mdi".
Icon Sets
Strato
| Prefix | Example | Browse |
|---|---|---|
strato/ or none | LineChartIcon, strato/SettingIcon | Strato icons |
The icons of the Strato design system, which the dashboard builder is built with. They match the look of the builder
best. All Strato icon names end with Icon.
React Icons
Four icon sets of react-icons are available. The prefix is the folder the
icon set is imported from in react-icons: an icon imported from react-icons/fa6 is referenced as fa6/FaHouse.
| Prefix | Icon set | Example | Browse |
|---|---|---|---|
md/ | Material Design Icons | md/MdHome | Material Design |
tb/ | Tabler Icons | tb/TbHome | Tabler |
lu/ | Lucide | lu/LuHouse | Lucide |
fa6/ | Font Awesome 6, including brand logos | fa6/FaHouse | Font Awesome 6 |
Other react-icons sets (e.g. gi/, si/ or fa/) aren't available. Their icons aren't shown, and the console shows
Unknown icon source for them.
MoBro ships react-icons 5. The react-icons website always shows the latest version, which can contain icons that aren't available in MoBro yet. If an icon doesn't show up, check the console for a warning and pick another icon.
Stick to one or two icon sets within a widget, so the icons of its options look alike.
Example
A button group with icon-only buttons and a select with icons from Strato and Material Design:
{
"config": [
{
"name": "text_align",
"label": "Alignment",
"type": "button-group",
"defaultValue": "left",
"options": [
{"value": "left", "icon": "lu/LuAlignLeft"},
{"value": "center", "icon": "lu/LuAlignCenter"},
{"value": "right", "icon": "lu/LuAlignRight"}
]
},
{
"name": "chart_type",
"label": "Chart type",
"type": "select",
"defaultValue": "line",
"options": [
{"label": "Line", "value": "line", "icon": "LineChartIcon"},
{"label": "Bar", "value": "bar", "icon": "md/MdBarChart"},
{"label": "Pie", "value": "pie", "icon": "md/MdPieChart"}
]
}
]
}