Skip to main content

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"}
FieldWhere the icon is shown
selectNext to the label of the option, and in the select while the option is selected.
multi-selectNext to the label of the option.
button-groupOn 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/MdHome works as well.
  • The icon name is the exact, case-sensitive name of the icon component, e.g. MdHome or LineChartIcon.

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​

PrefixExampleBrowse
strato/ or noneLineChartIcon, strato/SettingIconStrato 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.

PrefixIcon setExampleBrowse
md/Material Design Iconsmd/MdHomeMaterial Design
tb/Tabler Iconstb/TbHomeTabler
lu/Lucidelu/LuHouseLucide
fa6/Font Awesome 6, including brand logosfa6/FaHouseFont 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.

react-icons version

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.

tip

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:

mobro-widget-config.json
{
"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"}
]
}
]
}