@inkoxide/react
v0.4.0
Published
React components and reconciler that build Inkoxide document trees.
Readme
@inkoxide/react
React components and a custom reconciler that build Inkoxide document trees. Style with style, or with className when @inkoxide/tailwind is installed; fonts come from a registry. To make PDFs, install @inkoxide/render, which re-exports these components.
Part of Inkoxide. Requires Node.js >=22; ES modules only.
npm install @inkoxide/reactUsage
import { readFileSync } from 'node:fs';
import { createElement as h } from 'react';
import { Document, Page, Text, fonts, renderToTree } from '@inkoxide/react';
fonts.register({ id: 'Inter-Regular', family: 'Inter' }, readFileSync('Inter-Regular.ttf'));
const doc = await renderToTree(
h(Document, null, h(Page, { size: 'A4', margin: '20mm' }, h(Text, { style: { fontSize: 18 } }, 'Hello'))),
);
console.log(JSON.stringify(doc)); // an Inkoxide document (schema v1); @inkoxide/render turns it into a PDFLicence
MIT
