Paragraphs and Formatting
Basic paragraphs​
A <paragraph> wraps one or more <run> elements. Each run is a contiguous span of text with the same formatting.
<paragraph>
<run>This is a simple paragraph.</run>
</paragraph>
Paragraph alignment and spacing​
<paragraph alignment="center" spacing={{ before: 240, after: 120 }}>
<run>Centered with spacing</run>
</paragraph>
<paragraph alignment="justify" indentation={{ left: 720, firstLine: 360 }}>
<run>Justified text with left indent and first-line indent.</run>
</paragraph>
Alignment values: "left", "center", "right", "justify", "start", "end", "both".
Run formatting​
Runs support rich formatting through boolean flags and value props:
<paragraph>
<run bold>Bold text</run>
<run italic>Italic text</run>
<run bold italic>Bold and italic</run>
<run underline="single">Underlined</run>
<run strike>Strikethrough</run>
<run fontSize={28} fontFamily="Georgia" color="2E74B5">
Custom font, size, and color
</run>
</paragraph>
All run props​
| Prop | Type | Description |
|---|---|---|
bold | boolean | Bold text |
italic | boolean | Italic text |
underline | UnderlineStyle | boolean | Underline (e.g., "single", "double", "dotted") |
strike | boolean | Strikethrough |
doubleStrike | boolean | Double strikethrough |
fontSize | number | Font size in half-points (24 = 12pt) |
fontFamily | string | Font name (e.g., "Calibri") |
color | string | Hex color without # (e.g., "FF0000") |
highlight | HighlightColor | Background highlight color |
superscript | boolean | Superscript |
subscript | boolean | Subscript |
allCaps | boolean | All capitals |
smallCaps | boolean | Small capitals |
characterSpacing | number | Spacing adjustment in twips |
Headings​
Use the <heading> element for structured headings:
<heading level={1}><run>Chapter Title</run></heading>
<heading level={2}><run>Section Title</run></heading>
Or apply heading styles to paragraphs:
<paragraph style="Heading1"><run>Chapter Title</run></paragraph>
Paragraph styles​
Reference named styles defined in the document or built-in Word styles:
<document styles={{
paragraphStyles: [{
id: "Quote",
name: "Quote",
alignment: "center",
spacing: { before: 200, after: 200 },
runProps: { italic: true, color: "595959" },
}],
}}>
<section>
<paragraph style="Quote"><run>A styled quote.</run></paragraph>
</section>
</document>
Breaks​
Insert page, line, or column breaks:
<paragraph><run>Before the break</run></paragraph>
<pagebreak />
<paragraph><run>On a new page</run></paragraph>
<paragraph>
<run>Line one</run>
<linebreak />
<run>Line two</run>
</paragraph>
Tabs​
<paragraph>
<run>Name</run>
<tab />
<run>Value</run>
</paragraph>