Docs /Mason

05-repeater.md

Grid

A Grid field holds any number of rows. Each row is built from columns — smaller fields you define on the brick.

Defining columns

When you set a field's kind to Grid, a column editor appears. Add a column for each cell (label, short name, kind and any options). Columns use the full range of field kinds — text, select, toggle, number, relationship, file and so on. A column can itself be a Grid, letting you nest one grid inside another up to two levels deep (Section → Rows → Items).

Authoring

Authors get an Add row button; each row can be reordered (drag the grip or move up / down), duplicated, or deleted.

Output

Loop the rows in your template (see Templating). The row count is available as {brick:<short_name>:count}.

Showing a column only on some rows

A column can carry conditions, exactly as a brick field can — but they are judged per row. Give a column a rule like "show when Media type is video" and the column appears on the rows where that is true and not on the others. Two rows of the same grid can legitimately show different inputs.

Set them on the column card in the brick's settings, under the field options. The sources offered are the other columns in the same row — a rule against one of the brick's own fields would be true for every row at once, which is a field condition rather than a column one, and belongs on the field.

Hiding never deletes anything. A value already entered stays in the row; make the condition true again and it comes back. On the front end a hidden column simply emits nothing, so {brick:image} renders empty rather than the row disappearing.

This is worth knowing about because neither ExpressionEngine's own Grid nor Bloqs can do it — a media grid that asks for an image or a video, per row, is a single Mason grid rather than two fields and a note in the instructions.