vercel-labs avatar

React Pdf

If you need to generate PDFs programmatically from JSON specs, this is a clean wrapper around react-pdf/renderer. You define your document structure as JSON with elements like Document, Page, Table, and Heading, then render to buffer, stream, or file. The component library covers the basics (flex layouts, tables, images, page numbers) and you can extend it with custom components through a typed catalog system. The external store option is nice if you need to manage state outside the rendering cycle. It's server-safe imports mean you can work with schemas without pulling in React, which matters for edge environments. Solid choice if you're already in the JSON render ecosystem or want declarative PDF generation without wrestling with layout primitives.

skills.sh installs
2.4K
GitHub stars
19.5K
last updated
Aug 21, 2026

Install

$ npx -y skills add vercel-labs/json-render --skill react-pdf --agent claude-code

Installs into .claude/skills of the current project.

Files

@json-render/react-pdf

React PDF renderer that generates PDF documents from JSON specs using @react-pdf/renderer.

Installation

npm install @json-render/core @json-render/react-pdf

Quick Start

import { renderToBuffer } from "@json-render/react-pdf";
import type { Spec } from "@json-render/core";

const spec: Spec = {
  root: "doc",
  elements: {
    doc: { type: "Document", props: { title: "Invoice" }, children: ["page"] },
    page: {
      type: "Page",
      props: { size: "A4" },
      children: ["heading", "table"],
    },
    heading: {
      type: "Heading",
      props: { text: "Invoice #1234", level: "h1" },
      children: [],
    },
    table: {
      type: "Table",
      props: {
        columns: [
          { header: "Item", width: "60%" },
          { header: "Price", width: "40%", align: "right" },
        ],
        rows: [
          ["Widget A", "$10.00"],
          ["Widget B", "$25.00"],
        ],
      },
      children: [],
    },
  },
};

const buffer = await renderToBuffer(spec);

Render APIs

import { renderToBuffer, renderToStream, renderToFile } from "@json-render/react-pdf";

Sponsors

Details

Repository
github.com/vercel-labs/json-render
Categories
Frontend Development, Cloud & Infrastructure, Office & Documents
First seen
Apr 16, 2026

More from vercel-labs/json-render

All 31
1sergiodxa avatarfrontend-testing-best-practicessergiodxa/agent-skillsTesting best practices for the frontend. Emphasizes E2E tests over unit tests, minimal mocking, and testing behavior over implementation details. Use when writi2.2Kskills.sh installs
2getsentry avatarsentry-svelte-sdkgetsentry/sentry-for-aiFull Sentry SDK setup for Svelte and SvelteKit. Use when asked to "add Sentry to Svelte", "add Sentry to SvelteKit", "install @sentry/sveltekit", or configure e2.2Kskills.sh installs
3patternsdev avatarreact-2026patternsdev/skillsProvides a comprehensive guide to the modern React 2026 stack. Use when starting a new React project or modernizing an existing one with current frameworks, bui2.1Kskills.sh installs
4aradotso avatarui-ux-pro-max-skillaradotso/trending-skillsui ux pro max skill1.9Kskills.sh installs
5nexu-io avatardesign-taste-frontend-v1nexu-io/open-designThe original v1 taste-skill, preserved for projects depending on its exact behavior. The current default is `design-taste-frontend` (v2 experimental), which is 1.8Kskills.sh installs
6botpress avataradk-frontendbotpress/skillsGuidelines for building frontend applications that integrate with Botpress ADK bots - covering authentication, type generation, client setup, and calling bot ac1.7Kskills.sh installs