Grid
A multi-column grid. Children fill columns left-to-right and wrap to new rows. Grid rows are atomic — a row will not split across pages. A row taller than a page is cut at the bottom of the page, and the rows after it start the next.
Use grid for uniform card layouts. For tabular data with column headers, use table instead.
Attributes
Section titled “Attributes”| Attribute | Type | Default | Description |
|---|---|---|---|
cols |
integer | 1 | Number of columns (1–12) |
col-width |
token/length | — | Minimum column width: the grid fits as many columns as the width allows, at least one, and stretches them to fill the row (overrides cols) |
gap |
token/length | — | Gap between cells |
width |
token/length | — | Constrain total width |
padding |
spacing | — | Inner padding |
background |
color or gradient:name |
— | Background: a color, or a gradient that spans the box |
border |
string | — | Border |
radius |
token/length | — | Corner radius |
color |
color | inherit | Color of the text inside. A text that sets none takes the nearest box’s. See Text color in a box |
opacity |
0–1 | 1 |
How opaque the box and everything in it is, as one. See Opacity |
shadow |
string | — | A hard-edged shadow under the box: "x y color", with an optional opacity. See Shadow |
font |
string | inherit | Font name |
font-size |
token/length | inherit | Font size |
paginate |
string | — | Page breaks: no break-before break-after keep-next. See Page breaks |
bulk |
boolean | false |
true lays out the cells of its child with data-source a page at a time, straight from the data, for sheets of tens of thousands of labels or cards. See Bulk Records |
data-source |
string | — | Dot-path to array — repeats children per item |
data-color |
string | — | Dot-path: sets color from the data. See Attributes from data |
data-background |
string | — | Dot-path: sets background from the data. See Attributes from data |
ocg |
string | — | print or screen: shown only in print, or only on screen. See Print and screen content |
Three-column layout
Section titled “Three-column layout”<grid cols="3" gap="m"> <frame padding="m" border="xs #e0e0e0" radius="s"> <column gap="4pt"> <text font-size="s">Feature A</text> <text font-size="xs" color="#666666">Short description.</text> </column> </frame> <frame padding="m" border="xs #e0e0e0" radius="s"> <column gap="4pt"> <text font-size="s">Feature B</text> <text font-size="xs" color="#666666">Short description.</text> </column> </frame> <frame padding="m" border="xs #e0e0e0" radius="s"> <column gap="4pt"> <text font-size="s">Feature C</text> <text font-size="xs" color="#666666">Short description.</text> </column> </frame></grid>L.grid({ cols: 3, gap: 'm' }, [ L.frame({ padding: 'm', border: 'xs #e0e0e0', radius: 's' }, [ L.column({ gap: '4pt' }, [ L.text({ fontSize: 's' }, ['Feature A']), L.text({ fontSize: 'xs', color: '#666666' }, ['Short description.']), ]), ]), L.frame({ padding: 'm', border: 'xs #e0e0e0', radius: 's' }, [ L.column({ gap: '4pt' }, [ L.text({ fontSize: 's' }, ['Feature B']), L.text({ fontSize: 'xs', color: '#666666' }, ['Short description.']), ]), ]), L.frame({ padding: 'm', border: 'xs #e0e0e0', radius: 's' }, [ L.column({ gap: '4pt' }, [ L.text({ fontSize: 's' }, ['Feature C']), L.text({ fontSize: 'xs', color: '#666666' }, ['Short description.']), ]), ]),])L.grid(GridAttr(cols=3, gap='m'), [ L.frame(FrameAttr(padding='m', border='xs #e0e0e0', radius='s'), [ L.column(ColumnAttr(gap='4pt'), [ L.text(TextAttr(font_size='s'), ['Feature A']), L.text(TextAttr(font_size='xs', color='#666666'), ['Short description.']) ]) ]), L.frame(FrameAttr(padding='m', border='xs #e0e0e0', radius='s'), [ L.column(ColumnAttr(gap='4pt'), [ L.text(TextAttr(font_size='s'), ['Feature B']), L.text(TextAttr(font_size='xs', color='#666666'), ['Short description.']) ]) ]), L.frame(FrameAttr(padding='m', border='xs #e0e0e0', radius='s'), [ L.column(ColumnAttr(gap='4pt'), [ L.text(TextAttr(font_size='s'), ['Feature C']), L.text(TextAttr(font_size='xs', color='#666666'), ['Short description.']) ]) ])])L.grid(new GridAttr().cols(3).gap("m"), List.of( L.frame(new FrameAttr().padding("m").border("xs #e0e0e0").radius("s"), List.of( L.column(new ColumnAttr().gap("4pt"), List.of( L.text(new TextAttr().fontSize("s"), List.of("Feature A")), L.text(new TextAttr().fontSize("xs").color("#666666"), List.of("Short description.")) )) )), L.frame(new FrameAttr().padding("m").border("xs #e0e0e0").radius("s"), List.of( L.column(new ColumnAttr().gap("4pt"), List.of( L.text(new TextAttr().fontSize("s"), List.of("Feature B")), L.text(new TextAttr().fontSize("xs").color("#666666"), List.of("Short description.")) )) )), L.frame(new FrameAttr().padding("m").border("xs #e0e0e0").radius("s"), List.of( L.column(new ColumnAttr().gap("4pt"), List.of( L.text(new TextAttr().fontSize("s"), List.of("Feature C")), L.text(new TextAttr().fontSize("xs").color("#666666"), List.of("Short description.")) )) ))))L.Grid(new() { Cols = 3, Gap = "m" }, [ L.Frame(new() { Padding = "m", Border = "xs #e0e0e0", Radius = "s" }, [ L.Column(new() { Gap = "4pt" }, [ L.Text(new() { FontSize = "s" }, ["Feature A"]), L.Text(new() { FontSize = "xs", Color = "#666666" }, ["Short description."]), ]), ]), L.Frame(new() { Padding = "m", Border = "xs #e0e0e0", Radius = "s" }, [ L.Column(new() { Gap = "4pt" }, [ L.Text(new() { FontSize = "s" }, ["Feature B"]), L.Text(new() { FontSize = "xs", Color = "#666666" }, ["Short description."]), ]), ]), L.Frame(new() { Padding = "m", Border = "xs #e0e0e0", Radius = "s" }, [ L.Column(new() { Gap = "4pt" }, [ L.Text(new() { FontSize = "s" }, ["Feature C"]), L.Text(new() { FontSize = "xs", Color = "#666666" }, ["Short description."]), ]), ]),])L::grid(new GridAttr(cols: 3, gap: 'm'), [ L::frame(new FrameAttr(padding: 'm', border: 'xs #e0e0e0', radius: 's'), [ L::column(new ColumnAttr(gap: '4pt'), [ L::text(new TextAttr(fontSize: 's'), ['Feature A']), L::text(new TextAttr(fontSize: 'xs', color: '#666666'), ['Short description.']), ]), ]), L::frame(new FrameAttr(padding: 'm', border: 'xs #e0e0e0', radius: 's'), [ L::column(new ColumnAttr(gap: '4pt'), [ L::text(new TextAttr(fontSize: 's'), ['Feature B']), L::text(new TextAttr(fontSize: 'xs', color: '#666666'), ['Short description.']), ]), ]), L::frame(new FrameAttr(padding: 'm', border: 'xs #e0e0e0', radius: 's'), [ L::column(new ColumnAttr(gap: '4pt'), [ L::text(new TextAttr(fontSize: 's'), ['Feature C']), L::text(new TextAttr(fontSize: 'xs', color: '#666666'), ['Short description.']), ]), ]),])Data-driven grid
Section titled “Data-driven grid”<grid cols="2" gap="m" data-source="products"> <frame padding="m" border="xs #e0e0e0" radius="s"> <column gap="4pt"> <text font-size="s" data-value="name">Product name</text> <text font-size="xs" color="#666666" data-value="price">$0.00</text> </column> </frame></grid>