Skip to content
LpdfDocsv0.24-r1004.10

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

Frame

An atomic box around a single child, which it centres. A frame will never split across pages — if it doesn’t fit on the current page it moves in full to the next. Use it for callout boxes, cards, and labelled regions. To put several elements in a frame, wrap them in a stack. A frame takes no gap, align or justify, and a second child is an error.

To allow contents to flow across pages, use stack with padding and background instead.

Attribute Type Default Description
padding spacing — Inner padding: 16pt or shorthand "16pt 12pt"
background color — Background color
border string — Border: "s #cccccc" or "1pt #cccccc"
radius token/pt — Corner radius
height pt/fill/full — Fixed height
width token/pt — Constrain width
font string inherit Font name
font-size token/pt inherit Font size
data-if string — Render only when value is truthy
data-if-not string — Render only when value is falsy
<frame padding="m" background="#fff8e1" border="s #f9a825" radius="s">
<stack gap="4pt">
<text font-size="s">Note</text>
<text font-size="xs">This is an important callout.</text>
</stack>
</frame>
<!-- shown only when customer.isPremium is truthy -->
<frame data-if="customer.isPremium" padding="xs" background="#ffd700" radius="xs">
<text align="center" font-size="xs">★ Premium Customer</text>
</frame>
<!-- shown only when customer.isPremium is falsy -->
<frame data-if-not="customer.isPremium" padding="xs" background="#f0f0f0" radius="xs">
<text align="center" font-size="xs">Standard Customer</text>
</frame>
<frame height="120pt" border="xs #e0e0e0">
<text align="center" color="#aaaaaa">Signature</text>
</frame>