Takumi

Pagination

Control where pages break with CSS.

Content lays out once at unbounded height. It then splits into pages. Unsplittable atoms never straddle a cut. These atoms include text lines, images, and transformed subtrees. A cut inside an atom moves to its top. This matches browser print fragmentation.

Break properties

const  = await (
  <>
    < ={{ : "page" }}>Chapter two</>
    < ={{ : "avoid" }}>Keep this together.</>
  </>,
);
PropertyEffect
break-before: pageStarts the element on a new page.
break-after: pageStarts the following content on a new page.
break-inside: avoidKeeps the element on one page when it fits.
box-decoration-break: cloneRepeats borders and backgrounds on every page fragment.

A break-inside: avoid box taller than the page window cannot fit on a page. It stops participating in cut avoidance. Browsers apply the same rule.

Split decorations

A box that crosses a page break slices its border and background by default. Set box-decoration-break: clone to give each fragment complete decorations:

  <
    ={{
      : "1px solid #d1d5db",
      : 8,
      : "clone",
    }}
  >
    Long content that continues on the next page.
  </>,

Last updated on

On this page