> ## 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.

# Installation

<Tabs>
  <Tab title="npm">
    ```bash theme={"dark"}
    npm install @cordel/react-docx
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={"dark"}
    pnpm add @cordel/react-docx
    ```
  </Tab>

  <Tab title="yarn">
    ```bash theme={"dark"}
    yarn add @cordel/react-docx
    ```
  </Tab>

  <Tab title="bun">
    ```bash theme={"dark"}
    bun add @cordel/react-docx
    ```
  </Tab>
</Tabs>

Requires React 19+.

***

## TypeScript

Types are included. No `@types` package needed.

```json theme={"dark"}
{
  "compilerOptions": {
    "jsx": "react-jsx",
    "moduleResolution": "bundler"
  }
}
```

***

## Quick check

```tsx theme={"dark"}
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);
```

```bash theme={"dark"}
npx tsx test.tsx
```

If `test.docx` opens in Word, you're good.
