Template editor
Docs/Design templates

Long tables and pagination

Let long tables flow across sheets, keep short blocks together, and choose where a new section starts.

5 min read5 sections
On this page

As you build a layout, you may want some content to flow continuously, a block to stay together, or a new part to start on its own sheet. Tembuilder lets you combine these approaches within the same template.

Set the pagination behavior for each section in Config → Page breaks. This guide covers those options, long tables, and CSS rules that can affect page breaks.

1. Open a section’s page-break settings

Select the section in Structure, then open Config → Page breaks. There are two controls:

  • Keep together: whether the section can split across PDF sheets.
  • Page break: whether to force a break before or after the section.

The controls are independent. A section can start on a new sheet and still continue across several sheets when its content is long.

For a table or list with a variable number of rows, start with Keep together: Off and Page break: None to let the content flow.

Structure → Invoice Items → Config
STRUCTURE
⌄ Invoice
Billing Parties
Invoice Items
Settlement
HTMLCSSPropsConfig
Page breaks
Keep together
OffOn
Page break
NoneBeforeAfterBoth
Structure → Section → Config → Page breaks

2. Keep a content block together

Use Keep together: On for a short section that should stay intact, such as a signature, payment details, or a summary. If the remaining space is too small, the section moves to the next sheet.

Use Off for a long table or list that needs to continue across sheets. Keeping the whole table together can leave a large gap on the preceding sheet.

The setting applies to the whole section. To keep only the signature together, make it a separate section rather than enabling On for a section containing the entire service table.

Keep together
OffOn
Off
APPROVAL
1
Signature
2
On
1
APPROVALSignature
2
On → move the signature section together onto the next sheet

3. Choose where a new section starts

Use Page break to separate document parts, such as starting the terms on a new sheet after an invoice.

Option Behavior
None Do not force a break before or after the section.
Before Start this section on a new sheet when content precedes it.
After Start the next section on a new sheet.
Both Break before and after the section when content exists on both sides.

Both does not limit the section to one sheet. Keep together still controls splitting within the section.

A break at an existing page boundary does not add a blank sheet. For example, Before on the first section does not insert a blank sheet before the document.

Page break
NoneBeforeAfterBoth
Content
1
Terms
2
Before → start the section on a new sheet

4. Let long tables continue across sheets

Set Keep together: Off on the section containing the table. Use <thead> for the header and <tbody> for data rows. The <thead> header repeats when the table continues onto another sheet.

For service rows, generate table content from params.lineItems:

<table>
  <thead>
    <tr><th>Service</th><th>Quantity</th><th>Amount</th></tr>
  </thead>
  <tbody>
    {{#each params.lineItems}}
      <tr>
        <td>{{ description }}</td>
        <td>{{ qty }}</td>
        <td>{{ amount }}</td>
      </tr>
    {{/each}}
  </tbody>
</table>

To place totals after the final table row, put them after the table or in the following section with Page break: None. To keep the totals intact, enable Keep together on the totals section only.

See Arrays and objects for more on passing lists into a template.

Keep together: OffPage break: None
SERVICEQTY
Service 11
Service 21
Service 31
Service 41
Service 51
1
SERVICEQTY
Service 61
Service 71
Service 81
Service 91
Service 101
2
The table continues onto the next sheet with its thead header repeated

5. When content is clipped or moves as a block

These symptoms usually point to different settings:

Symptom Where to look
A whole section moves to the next sheet, leaving a large gap The section’s Keep together setting and break-inside on its container.
Final rows disappear at a container’s edge The container’s CSS height, max-height, and overflow.
A section always starts on a new sheet despite available space Its Page break: Before/Both, After on the preceding section, or CSS break-before.

For example, an .items container with a fixed height and overflow: hidden clips anything beyond its box. If it should grow with the list, remove the height limit and allow visible content, as illustrated below.

Config controls the section itself. Elements inside it can still have their own CSS break rules, so inspect those if changing Config does not change the result.

HTMLCSSPropsConfig
Fixed-height container
.items {
height: 120px;
overflow: hidden;
}
Content-sized container
.items {
height: auto;
overflow: visible;
}
Section CSS → adjust the container that limits or clips content

Search documentation