Introduction
DocMosaic is a headless PDF editor for the web - compound React primitives on top of a framework-agnostic core. Open source. Open code.
DocMosaic is a fully client-side PDF builder. Users drop images, text, shapes, drawings, and frames into sections on a virtual page - including container frames that group elements and Canva-style shaped image slots; the entire document model lives in React state and is rendered to a PDF in the browser via jspdf. No backend, no uploads - privacy is a product promise, not a side effect.
The library splits into two packages:
@docmosaic/core- framework-agnostic document model, reducer + history timeline, page-size math, and thejspdfgeneration pipeline. No React.@docmosaic/react- compound<Editor.*>primitives plus a headlessuseDocumentStatehook. Sits on top of@docmosaic/coreas a peer.
Two ways to consume
Default shell. Drop in <Editor.Root> and let the primitives lay themselves out - toolbar, page list, canvas, preview. You get the full editor with zero config.
Compose your own UI. Use useDocumentState for the headless state machine and render whatever UI you want. Wire individual Editor.* primitives into your design system without touching the default shell.
What's next
- Installation - get the packages into your project
- Quick start - minimal copy-paste editor in 30 seconds
- Controlled vs uncontrolled - how state ownership works
- Designer - the mental model behind the primitives