Skip to main content

Rows and Columns

Rows and columns put fields side by side, like the grid of Bootstrap. A row holds columns, and the columns hold the fields and layout elements. Use them for fields that belong together and are narrow enough to share a line, like a width and a height, or a font and its color.

Row​

type: "row"

Puts its columns next to each other. A row only holds column elements; to put a field into a row, put it into a column of the row.

PropertyTypeRestrictionsDescription
typestringRequiredAlways row.
childrencolumn[]-The columns of the row.
visibleIfCondition-Only shows the row while the condition passes.
hideIfCondition-Hides the row while the condition passes.

Column​

type: "column"

A column within a row. Can only be used as a child of row.

PropertyTypeRestrictionsDescription
typestringRequiredAlways column.
spannumber or string1 to 12, see SpanHow many of the 12 columns of the row this column takes.
childrenlayout-The field names and layout elements within the column.
visibleIfCondition-Only shows the column while the condition passes.
hideIfCondition-Hides the column while the condition passes.

A column can hold anything a layout can hold, including fieldsets, tabs and further rows.

Span​

A row is divided into 12 columns. The span of a column says how many of them it takes, e.g. 6 for half of the row or 4 for a third.

Columns without a span share the room the other columns leave equally. A row with two columns without a span shows them side by side at half the width each. Columns without a span wrap to the next line before they get narrower than 80px, so they also work in a narrow sidebar.

Columns whose spans add up to more than 12 wrap to the next line.

Narrow Rows​

The settings sidebar of the dashboard builder is narrow, and rows within a fieldset or a repeater item are even narrower. A span given as a text can change the span on narrow rows:

SpanTakes
66 of 12 columns at any width.
"6"The same as 6.
"6 s-12"6 of 12 columns, and the whole row on rows narrower than 300px (s).
"s-12"An equal share of the row, and the whole row on rows narrower than 300px.

The breakpoint is based on the width of the row, not of the window, so the same widget config adapts to wherever the row is shown.

Example​

The width and height of a widget side by side, followed by a font and a color, that stack below each other on narrow rows:

mobro-widget-config.json
{
"layout": [
{
"type": "row",
"children": [
{"type": "column", "children": ["width"]},
{"type": "column", "children": ["height"]}
]
},
{
"type": "row",
"children": [
{"type": "column", "span": "8 s-12", "children": ["font"]},
{"type": "column", "span": "4 s-12", "children": ["font_color"]}
]
}
]
}

A column that is hidden by its condition frees its room for the other columns of the row. If all columns of a row are hidden, the row isn't shown at all.