Skip to main content
React DOCX maps Tailwind classes to DOCX properties. Not everything works (DOCX isn’t CSS) but the common stuff does.

Text

Colors

All Tailwind colors work: red, blue, green, yellow, purple, pink, orange, gray, slate, zinc, neutral, stone, amber, lime, emerald, teal, cyan, sky, indigo, violet, fuchsia, rose. Shades: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900.

Formatting

Sizes

Full range: text-xs through text-9xl.

Fonts

Font weight

Full range: font-thin, font-extralight, font-light, font-normal, font-medium, font-semibold, font-bold, font-extrabold, font-black.

Super/subscript

Letter spacing


Paragraphs

Alignment

Spacing

Indentation

Line height

Options: leading-none, leading-tight, leading-snug, leading-normal, leading-relaxed, leading-loose.

Background


Tables

Borders

Border widths: border, border-0, border-2, border-4, border-8. Individual sides: border-t, border-b, border-l, border-r.

Border colors

Border styles

Per-side styles:

Padding

Cell alignment

Background


Images

Object fit

Aspect ratio


Custom config

Drop a tailwind.config.js (or .ts, .mjs, .cjs) in your project root. React DOCX loads it automatically.

Custom colors

Custom fonts

Font must exist on the machine opening the document.

Custom sizes

Supports rem, px, and pt values.

Class merging

Later classes win:
Child classes override parent classes.

Arbitrary values

Use bracket syntax for values not in the default scale:
Supported units in arbitrary values: px, pt.

What doesn’t work

These have no DOCX equivalent:
  • opacity-*
  • z-*
  • flex, grid, float
  • shadow-*
  • rotate-*, scale-*, translate-*
  • blur-*, brightness-*
  • bg-gradient-*
  • rounded-* (except on tables/cells via borders)
  • w-*, h-* (use component props instead)