↓ Skip to main content
Two pixel art toolbar strips, the upper one holding six icon buttons with only the middle one filled solid, the lower one holding three smaller buttons

Buttons and Actions

The button is the element you will write most often, and the reference describes it as a list of attributes with no sense of which ones matter. This page reads the buttons in IBM’s shipped apps and reports what they actually set. Four of the answers are worth knowing before you write your first toolbar.

MAS 9.2 series framework 3.2.8xx

For the full component catalogue see the UI Components guide, which places the button beside everything else. This page is about the button itself and the elements that surround it.

The proportions come from the apps that IBM ships with a 9.2-series install, as Application Configuration shows them. The pictures come from our own Components Explorer app, a small MAF app we built for these articles. IBM releases about once a month, so details move and the proportions hold.

Here is a toolbar and the five kinds on one screen, in Maximo Mobile at tablet width:

Maximo Mobile at tablet width. At the top a toolbar of four buttons: three round icon buttons for edit, attachments and more, and a blue primary button “Complete” with a tick. Below it five buttons, one per kind: ghost, tertiary and secondary as blue text beside a round icon, primary as a filled blue rectangle, and danger in red with a trash can icon.
A button group and the five kinds of button, in Maximo Mobile at tablet width, in the preview of our MAF editor

The toolbar is a <button-group>:

<button-group id="fs_a_toolbar_group" align="start">
  <button id="fs_a_toolbar_edit" kind="ghost" icon="carbon:edit"
          hover-tooltip="Edit" on-click="toast" on-click-arg="Edit"/>
  <button id="fs_a_toolbar_attach" kind="ghost" icon="carbon:attachment"
          hover-tooltip="Attachments" on-click="toast"
          on-click-arg="Attachments"/>
  <button id="fs_a_toolbar_more" kind="ghost"
          icon="carbon:overflow-menu--vertical" hover-tooltip="More actions"
          on-click="toast" on-click-arg="More actions"/>
  <button id="fs_a_toolbar_complete" kind="primary" icon="carbon:checkmark"
          label="Complete" on-click="toast" on-click-arg="Complete"/>
</button-group>

On a phone the same group has less room, and it drops the label. “Complete” keeps its tick and loses its word, so all four buttons are round icons. Give every button in a group an icon, or the label is all it has to lose.

Maximo Mobile at phone width. The same toolbar shows four round icon buttons: edit, attachments, more and a blue tick. The label “Complete” is gone. Below it the five kinds stand one under the other.
The same button group at phone width: the label of the primary button is gone, in the preview of our MAF editor

What a real button sets
#

The attributes of a button fall into four groups, from the ones every button carries to the ones only a few use:

  • Nearly every button sets id.
  • Most buttons set icon, on-click and kind.
  • Many buttons set label, on-click-arg, slot and hidden.
  • A smaller group sets disabled, padding, lookup, loading, hover-tooltip and dialog.

Buttons in these apps are icon-first. An icon sits on most buttons and a text label on clearly fewer, so the normal button is a glyph. That follows from the screen: a technician holds a phone in one hand, and a toolbar of words does not fit. Hardly any button has neither an icon nor a label.

If you set only an icon, set hover-tooltip as well. Only a few buttons do, and more of them should.

Visual weight, and the surprise in it
#

kind decides how loud a button looks, and the distribution runs against the instinct most people bring from web design. From the most used to the least used, the kinds are:

  1. ghost
  2. secondary
  3. primary
  4. tertiary
  5. danger

The loudest button is the rarest. Ghost is the quietest of them, and it is used several times as often as primary. Danger is the rarest kind of all.

The reason is the shape of these screens. A work order detail page carries ten or fifteen actions, and if three of them shout then none of them does. Primary is reserved for the one thing the user came to do, and everything else recedes. A few buttons go further and compute their kind from a binding, so the same button is primary on the record the user is working on and secondary everywhere else.

Turning a button on and off
#

hidden and disabled are the two attributes that decide whether a button is available, and almost nobody hard-codes them.

Of the buttons that set hidden, the large majority bind it to an expression. For disabled the share is even higher, close to all of them. A literal hidden="true" is rare enough to look like a mistake.

<button label="Complete" icon="carbon:checkmark"
        disabled="{!page.state.canComplete}"
        on-click="completeWorkOrder"/>

This is why state management matters more than it first appears. A toolbar is a set of booleans on the page, and the buttons are a view of them. Write the flags well and the toolbar takes care of itself.

Some buttons need no controller
#

A button can carry the navigation itself, with no handler written anywhere.

AttributeWhat it does
lookupopens a lookup dialog by id
dialogopens a dialog by id
sliding-draweropens a sliding drawer by id
flyoutopens a flyout by id
pagenavigates to a page by id
page-paramscarries the parameters that go with it

A button takes only one of lookup, dialog, sliding-drawer, flyout and page.

<button label="Add material" icon="carbon:add" dialog="addMaterialDialog"/>

That covers a minority of the buttons. The rest name a controller method through on-click, and many of those also pass a value through on-click-arg, which is nearly always the record the row is showing.

Choosing between a navigation attribute and a controller method Choosing between a navigation attribute and a controller method
Choosing between a navigation attribute and a controller method

The rule worth taking: if a button only opens something, say so in the markup. A handler that does nothing but call showDialog is a line of code with no reason to exist.

The elements around the button
#

  • <button-group> is the toolbar. It takes slot to place itself in a layout, align to push its contents left or right, and hidden so the whole group disappears at once. Grouping buttons is also how they stay tidy when the screen narrows.
  • <row-action> is the action of a single table row, and the table is a web element. It sits inside <row-actions> in a <table>, so it belongs to the MAF web apps and has no place in Maximo Mobile. It takes on-action where a button takes on-click. Its overflow attribute decides whether the action shows on the row or in the overflow menu, while hidden-attribute hides it for one record at a time.
  • <menu-item> is the action in a menu, and where it lives decides what it is. The Pages and Navigation guide covers the menu itself.
  • Permission gating lives on the menu. A sigoption attribute hides an action from users without that Maximo signature option. It appears far more often on <menu-item> than on <button>, so if an action needs to disappear for some users, the apps put it in a menu.

The row actions of a web table appear only while the pointer rests on the row. The sequence below runs in the web version of our Components Explorer, inside MAS. First the row without the pointer. Then the pointer rests on WO-1001, and “Start” and the overflow icon appear. A click on the overflow icon opens the menu with “Details”.

Three frames of a MAF web app inside the Maximo Application Suite. A table of work orders WO-1001 to WO-1006 with the columns Work order, Description, Status, Priority, Asset and Hours. In the second frame the first row is highlighted and shows the action “Start” with a tick and an overflow icon at the right end. In the third frame the overflow menu is open below the icon with the entry “Details”.
row-action with overflow false and true, in a MAF web app inside MAS, in the preview of our MAF editor
<table id="fs_l_table_tbl38" datasource="fs_l_table_ds_overflow_none"
       select-mode="none">
  <table-column id="fs_l_table_c38_wonum" name="wonum" label="Work order"/>
  <table-column id="fs_l_table_c38_description" name="description"
                label="Description"/>
  <row-actions id="fs_l_table_ra38">
    <row-action id="fs_l_table_ra38start" label="Start" icon="carbon:checkmark"
                overflow="false" on-action="toast" on-action-arg="Start"/>
    <row-action id="fs_l_table_ra38info" label="Details"
                icon="carbon:information" overflow="true"
                on-action="toast" on-action-arg="Details"/>
  </row-actions>
</table>

The table in the picture has four more columns: status, priority, asset and hours.

What to read next#