#3558·react-pdf

Tailwind class shadow-* is not recognised

Author: ismailuddinCreated Sep 5, 2026Updated Sep 5, 2026

Describe the bug When using @react-pdf/tailwind, if you use the Tailwind classes shadow-*, it complains with the error

@react-pdf/tailwind: Invalid class "shadow-lg"

To Reproduce Steps to reproduce the behavior including code snippet (if applies):

typescript
# main.tsx
import { Document, Page, Text, View } from "@react-pdf/renderer";
import { createTw } from "@react-pdf/tailwind";
import { renderToFile } from "@react-pdf/renderer";

const tw = createTw({});

const items = [
  { name: "Widget", qty: 2, price: 9.99 },
  { name: "Gadget", qty: 1, price: 19.99 },
  { name: "Doohickey", qty: 5, price: 2.5 },
];

export function Invoice() {
  return (
    <Document>
      <Page size="A4" style={tw("p-10 text-xs bg-gray-100")}>
        <View style={tw("p-3 bg-white shadow-lg rounded-lg")}>
          <Text style={tw("text-2xl font-bold text-blue-900 mb-3")}>
            Invoice
          </Text>
          {items.map((item) => (
            <View
              style={tw(
                "flex-row justify-between border-b border-gray-300 py-1",
              )}
              key={item.name}
            >
              <Text>{item.name}</Text>
              <Text>
                {item.qty} x ${item.price.toFixed(2)}
              </Text>
            </View>
          ))}
        </View>
      </Page>
    </Document>
  );
}
await renderToFile(<Invoice />, "invoice.pdf");
json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "jsx": "react-jsx",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true
  },
  "include": ["src"]
}
bash
pnpm add @react-pdf/renderer @react-pdf/tailwind react tailwindcss
pnpm add --save-dev @types/node @types/react tsx typescript

You can make use of react-pdf REPL to share the snippet

Expected behavior

All Tailwind classes should be able to be used.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. MacOS, Windows] macOS 15.7.4
  • Browser [e.g. chrome, safari] N/A
  • React-pdf version [e.g. v1.1.0] v4.9.0