Documentation Index
Fetch the complete documentation index at: https://react-docx.com/llms.txt
Use this file to discover all available pages before exploring further.
npm install @cordel/react-docx
pnpm add @cordel/react-docx
yarn add @cordel/react-docx
bun add @cordel/react-docx
Requires React 19+.
TypeScript
Types are included. No @types package needed.
{
"compilerOptions": {
"jsx": "react-jsx",
"moduleResolution": "bundler"
}
}
Quick check
import { Document, Section, Paragraph } from "@cordel/react-docx";
import { renderToBuffer } from "@cordel/react-docx";
import fs from "node:fs";
const Doc = () => (
<Document>
<Section>
<Paragraph>It works.</Paragraph>
</Section>
</Document>
);
const { buffer } = await renderToBuffer(<Doc />);
fs.writeFileSync("test.docx", buffer);
If test.docx opens in Word, you’re good.