Skip to content
LpdfDocsv0.36-r1119.4

Lpdf is pre-release. The XML schema and SDK APIs can change between releases.

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.

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
<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>
<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>