↓ Skip to main content
A pen and ink diagram of one frame with an orange band top and bottom, teal columns left and right, and three rose rectangles stacked in the hatched centre

Layout with Containers

Every Maximo Mobile screen is boxes inside boxes. Which container you reach for decides whether a row still reads on a phone, and the framework gives you four that matter. This page looks at how IBM’s own apps use them, which turns a list of attributes into a set of habits worth copying.

MAS 9.2 series framework 3.2.8xx

This page is about placing things. Anything that changes with screen size belongs to its companion, the Responsive Design guide, and the UI Components guide holds the component catalogue.

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 example apps, small Maximo Mobile apps we built for these articles. IBM releases about once a month, so details move and the proportions hold.

The box, and how it is really used
#

<box> is the most written layout element by a wide margin. The attributes that boxes set fall into three groups:

  • Nearly every box sets id, and most boxes set direction.
  • Many boxes set fill-parent, padding-top, padding-start, hidden and vertical-align.
  • A smaller group sets padding-bottom, padding, horizontal-align, children-sizes, padding-end, fill-parent-horizontal and background-color.

Column clearly beats row. Among the boxes that set a direction, far more stack downward than run across. Many boxes set no direction at all and take the default, so a good part of the boxes in the shipped apps never state which way they go.

Maximo Mobile on a tablet, switching between two tabs. The banner reads direction=“row”, then direction=“column”. The tiles A, B and C sit side by side, then stack, each stretched across the full width.
The same box with direction row and direction column, in Maximo Mobile on a tablet

This is the box behind the second frame. The first frame differs in one value, direction="row".

<box direction="column" border="true">
  <box background-color="interactive-01" min-width="4rem"><label label="A"/></box>
  <box background-color="support-02" min-width="4rem"><label label="B"/></box>
  <box background-color="support-03" min-width="4rem"><label label="C"/></box>
</box>

Many boxes carry nothing but an identifier, and they exist to group children so that a parent can align or hide them as one thing. That is a legitimate use and worth recognising, because an empty-looking box in someone else’s markup is usually doing that job.

Padding is set per side. The single-side attributes are used far more often than the shorthand. Maximo Mobile layouts are asymmetric by nature, with space above a group and none below it, or at the start of a row and none at the end.

Note the vocabulary, where start and end appear in place of left and right, because the framework supports languages that read the other way.

The border layout and its five slots
#

<border-layout> is the skeleton of a list row, a header and most detail panes. It owns five slots. The four edges shrink to fit their content and the middle takes everything left over.

The five slots of a border layout The five slots of a border layout
The five slots of a border layout
SlotWhat it usually holds
<start>an icon or a status marker
<middle>the text, which takes the space that is left
<end>a chevron or an icon
<top>the header of a page frame, used less often
<bottom>the footer of a page frame, used least often

The five-slot skeleton seldom uses all five. Most border layouts fill only a few of the slots. Start, middle and end carry the work, while top and bottom stay exceptional.

That fits what a border layout is usually doing, because a list row is an icon, a description and a chevron, which is exactly start, middle and end. Reaching for a border layout with all five slots is a sign that the thing you are building is a page frame.

Here is such a row in Maximo Mobile at tablet width. A status dot with its code sits in the start slot, the work order and its description fill the middle, and a chevron sits in the end slot.

Maximo Mobile at tablet width. A page “list-item: the row” with three tabs: middle, middle + end, and start + middle + end, the last one selected. Below it four list rows. Each row has a coloured dot and a status code at the left, such as WAPPR, APPR, INPRG and COMP, then a work order number with its description on two lines, and a chevron at the right end.
A list row with start, middle and end, in Maximo Mobile at tablet width, in the preview of our MAF editor
<list-item id="fs_l_item_start_item">
  <border-layout id="fs_l_item_start_row" fill-parent="true">
    <start id="fs_l_item_start_start" vertical-align="center">
      <icon-group id="fs_l_item_start_dot" aria-label="Status"
                  label="{item.status}" primary-icon="maximo:dot"
                  primary-icon-color="{item.status === 'COMP' ? 'green' : '#8d8d8d'}"/>
    </start>
    <middle id="fs_l_item_start_mid" vertical-align="center">
      <box id="fs_l_item_start_text" direction="column">
        <label id="fs_l_item_start_title" label="{item.wonum}"/>
        <label id="fs_l_item_start_sub" wrap="true" label="{item.description}"/>
      </box>
    </middle>
    <end id="fs_l_item_start_end" vertical-align="center">
      <icon id="fs_l_item_start_chev" icon="carbon:chevron--right" size="20"/>
    </end>
  </border-layout>
</list-item>

The picture shows the shrinking edges at work. The middle starts where the start slot ends, so it moves a little from row to row with the width of the status code. Our app also colours the dot yellow for INPRG; the fragment above keeps two colours for brevity.

The layout itself sets few attributes, mostly fill-parent and padding, and now and then background-color and width. Almost everything else is decided by the slots and by the boxes inside them.

Two more containers worth knowing
#

  • <panel> is a page inside a page. Panels live in a <stacked-panel>, and only one of them shows at a time. The stack’s selected-index picks it, usually bound to page state. Switching panels is how a screen moves between two views without navigating anywhere. A panel carries almost no attributes of its own, which is the point.
  • <button-group> is the toolbar. It takes slot to place itself, align to push its contents to one side, and hidden so a whole row of actions disappears together. Buttons and Actions covers what goes inside it.

The sequence below runs in our Components Explorer at phone width. A tap on WO-1003 shows its detail panel in place of the list. “Back to the list” shows the list again. The page stays the same the whole time.

Three frames of Maximo Mobile at phone width, all on the page “stacked-panel: list and detail in place”. First a list of work orders WO-1001 to WO-1008, each with a chevron. Second, the detail panel with a button “Back to the list” and the values of WO-1003: Conveyor belt tracking, Status INPRG, Location HALL-B. Third, the list again.
A stacked-panel with a list panel and a detail panel, in Maximo Mobile at phone width, in the preview of our MAF editor
<state id="fs_l_panels_panel" name="panel" type="number" value="0"/>

<stacked-panel id="fs_l_panels_stack" selected-index="{page.state.panel}">
  <panel id="fs_l_panels_list">
    <data-list id="fs_l_panels_dl" datasource="fs_l_panels_ds"
               on-item-click="showRecord" on-item-click-arg="{event}">
      <!-- the list-item of each row -->
    </data-list>
  </panel>
  <panel id="fs_l_panels_detail">
    <box id="fs_l_panels_detail_c" direction="column" padding="1">
      <button id="fs_l_panels_back" kind="ghost" icon="carbon:arrow--left"
              label="Back to the list" on-click="setState"
              on-click-arg="{{name: 'panel', value: 0}}"/>
      <label id="fs_l_panels_d_wonum" label="{page.state.recWonum}"/>
      <!-- more labels of the record -->
    </box>
  </panel>
</stacked-panel>

showRecord is a short controller method. It copies the values of the tapped row into page state and sets page.state.panel to 1. on-item-click-arg="{event}" hands it the tapped row, the form IBM’s apps use for that. setState sets the state back to 0.

Four rules that follow
#

  • Default to a box, and say which direction it goes. Many boxes in the shipped apps leave the direction implicit, and that is the single easiest thing to misread in somebody else’s markup.
  • Use a border layout the moment something has to sit at each end. Three slots and a middle that grows solves the row problem that a box with manual widths solves badly.
  • Set padding per side. The shorthand is convenient and it is rarely what the design wants.
  • Group with a bare box when you need to hide or align several things at once. Many boxes in the shipped apps exist for exactly that.

What to read next#