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.
Applies styling to text. Usually you don’t need it (plain strings work fine).
// Plain string - no Text needed
<Paragraph>Hello world</Paragraph>
// With styling - use Text
<Paragraph>
Hello <Text className="font-bold text-blue-600">world</Text>
</Paragraph>
When to use Text
Don’t need it:
<Paragraph>Just plain text</Paragraph>
<H1>Plain heading</H1>
Need it:
<Paragraph>
Mix of <Text className="font-bold">bold</Text> and normal
</Paragraph>
Rule: only wrap in <Text> when you need to apply classes.
Props
| Prop | Type | Description |
|---|
children | ReactNode | Text content |
className | string | Tailwind classes |
Styling
Font weight
<Text className="font-bold">Bold</Text>
<Text className="font-extrabold">Extra bold</Text>
Font style
<Text className="italic">Italic</Text>
<Text className="underline">Underlined</Text>
<Text className="line-through">Strikethrough</Text>
Colors
<Text className="text-red-500">Red text</Text>
<Text className="text-blue-700">Dark blue</Text>
<Text className="bg-yellow-200">Highlighted</Text>
Sizes
<Text className="text-xs">Extra small</Text>
<Text className="text-sm">Small</Text>
<Text className="text-base">Base</Text>
<Text className="text-lg">Large</Text>
<Text className="text-2xl">2XL</Text>
Font family
<Text className="font-serif">Serif font</Text>
<Text className="font-mono">Monospace</Text>
Caps
<Text className="uppercase">ALL CAPS</Text>
<Text className="capitalize">Small Caps</Text>
Super/subscript
<Paragraph>
H<Text className="align-sub text-xs">2</Text>O
</Paragraph>
<Paragraph>
E = mc<Text className="align-super text-xs">2</Text>
</Paragraph>
Instead of <Text className="font-bold">, use shortcuts:
<Bold>Bold text</Bold>
<Italic>Italic text</Italic>
<Underline>Underlined text</Underline>
<Strike>Strikethrough</Strike>
Combine them:
<Bold>
<Italic>Bold and italic</Italic>
</Bold>
<Bold className="text-red-500">Bold and red</Bold>
Combining styles
<Paragraph>
<Text className="text-2xl font-bold text-blue-700">Big bold blue</Text>
<Text className="text-sm text-gray-500"> (with small gray note)</Text>
</Paragraph>
Auto-generation
The React reconciler automatically wraps plain strings. This:
<Paragraph>Hello world</Paragraph>
Internally becomes:
<Paragraph>
<Text>Hello world</Text>
</Paragraph>
You never see this (it just works). Write plain strings, add <Text> only when styling.
Common patterns
Label + value
<Paragraph>
<Text className="font-bold">Name: </Text>John Doe
</Paragraph>
Colored keywords
<Paragraph>
Status: <Text className="text-green-600 font-bold">Active</Text>
</Paragraph>
Fine print
<Paragraph>
Main content here.
<Text className="text-xs text-gray-400"> *Terms apply</Text>
</Paragraph>
Code inline
<Paragraph>
Run <Text className="font-mono bg-gray-100">npm install</Text> to start.
</Paragraph>