Skip to content
Press.js Press.js Press.js Docs

Overview

Press.js provides a set of components that mark up your document structure. They emit data-press-* attributes that the pagination engine reads to understand headers, footers, page breaks, and other document semantics.

Both React and Vue packages export the same components and hooks.

Under the hood, every component is a thin wrapper that emits data-press-* attributes on a standard HTML element. These attributes are Press.js’s native API — you can use them from any framework, or no framework at all, by writing the HTML directly. Each element page below includes the native HTML equivalent.

ElementDescription
PageRoot document container with size, orientation, and margin control
HeaderContent repeated at the top of every page
FooterContent repeated at the bottom of every page
PageBreakForces a page break at the insertion point
KeepTogetherPrevents page breaks inside the wrapped content
KeepNextKeeps the element with its next sibling
PageNumberPlaceholder replaced with the current page number
TotalPagesPlaceholder replaced with the total page count
ExportDescription
usePressReadyReactive hook that signals the document is ready for capture
markPressReadyImperative version of usePressReady
reportPressRenderErrorReports a render error to the pipeline
shouldUsePressPreviewerDetects whether the previewer is active
import {
Page,
Header,
Footer,
KeepTogether,
KeepNext,
PageBreak,
PageNumber,
TotalPages,
usePressReady,
markPressReady,
reportPressRenderError,
shouldUsePressPreviewer,
} from "@press-js/react";

Types are also exported:

import type {
PageProps,
PressMarkerProps,
PressReadyOptions,
UsePressReadyOptions,
} from "@press-js/react";