Skip to content

Add an icon to a button or a menu entry

An icon helps a reader find a control at a glance. A plus sign says “new”. A pencil says “edit”. MatterData has a fixed set of icons. You name one, and the engine draws it.

Write icon and a name after the label. The icon appears before the text.

nav main "Club" {
dashboard "Overview" icon layout_dashboard
members icon users
}

The same words work after the label of a button, a row_action and a transition.

report of members "Members" {
button "New member" icon plus -> member
row_action "Edit" icon pencil -> member
}

Find the name you need on the Icons page. Names use underscores, for example trash_2. If you write a name that is not in the set, the compiler stops and shows the names it knows.

Some controls are small, and the icon is clear enough. Add only after the name.

report of members "Members" {
button "Import" icon upload only -> import
row_action "Edit" icon pencil only -> member
}

You still write the label. The engine keeps it as the name of the control, so a screen reader announces Edit and a mouse shows Edit as a tooltip. Use only for actions that most readers know. Keep the label visible for actions that are new to them.

Two rules apply:

  • A menu entry always shows its label, so only on a menu entry is a compile error.
  • A button in the menu next to the main button of a report always shows its label. The menu draws the icon and ignores only.
  • The icon has the colour of the text, in light and dark mode.
  • The icon is hidden from screen readers. The label is what they read.
  • The sheet draws its own icons. Undo and redo are icons. Add row, Delete rows and Save show an icon beside their words. You do not declare these.

The icons are from Lucide, under the ISC licence. matterdata notices prints the licence notice.

Website privacy policy