Components
Twelve primitives plus the <Document> root. Compose them like any other
React tree — they’re plain elements with __helixUiDocKind markers so the
exporter can dispatch on type without circular imports.
<Document>
Section titled “<Document>”The root container. Owns page geometry, theme, file metadata, and the DOM preview wrapper.
<Document pageSize="letter" // 'letter' | 'a4' | 'legal' | { w, h } orientation="portrait" // 'portrait' | 'landscape' margins={{ top: 1, right: 1, bottom: 1, left: 1 }} theme={{/* partial DocTheme */}} meta={{ title, author, subject, keywords, company }} exportFileName="brief.docx" showPageBoundary // dashed page outline in DOM preview> …blocks…</Document><DocSection>
Section titled “<DocSection>”Mid-document page-setup change. Each section becomes its own Section in
the exported file. By default, a section starts on a new page.
<DocSection pageSize="letter" orientation="landscape" margins={{ top: 0.5, right: 0.5, bottom: 0.5, left: 0.5 }} pageBreakBefore // default true> …blocks specific to this section…</DocSection><Heading>
Section titled “<Heading>”Word heading styles 1–6. Sizes derive from theme.headingFontSize unless
you override via size.
<Heading level={1} align="center" id="overview"> Overview</Heading>| Prop | Type | Default |
|---|---|---|
level |
1 | 2 | 3 | 4 | 5 | 6 |
required |
size |
points | derived from theme.headingFontSize |
align |
'left' | 'center' | 'right' | 'justify' |
undefined |
color |
DocColor |
'ink' |
id |
string | undefined (becomes a bookmark) |
<Paragraph>
Section titled “<Paragraph>”A block of text. Children may be plain strings, <DocText>, <DocLink>,
or any combination — they’re flattened into TextRuns on export.
<Paragraph align="justify" lineHeight={1.4} indent={0.25} spaceBefore={4} spaceAfter={6} style={{ size: 11, color: 'ink', font: 'body' }}> Body copy with <DocText weight="bold">strong emphasis</DocText> and a <DocLink href="https://helix-ui.com" external> {' '} link </DocLink> .</Paragraph><DocText>
Section titled “<DocText>”Inline run with full styling. Use inside <Paragraph>, <Heading>, or
<DocListItem>.
| Prop | Type | Notes |
|---|---|---|
size |
points | inherits paragraph size |
weight |
'regular' | 'medium' | 'semibold' | 'bold' |
'bold' and 'semibold' both bold in docx |
italic |
boolean | |
underline |
boolean | |
strike |
boolean | |
color |
DocColor |
theme key, css var, hex, etc. |
font |
'heading' | 'body' | 'mono' | string |
|
highlight |
DocColor |
mapped to nearest docx highlight enum |
vertAlign |
'sub' | 'super' |
maps to subscript / superscript |
<DocLink>
Section titled “<DocLink>”Inline hyperlink. Renders as a docx ExternalHyperlink with nested styled
runs.
<DocLink href="https://helix-ui.com" external // adds target=_blank in the DOM preview weight="semibold" color="accent"> helix-ui.com</DocLink><DocList> + <DocListItem>
Section titled “<DocList> + <DocListItem>”Bulleted, numbered, check, or arrow lists. Items support per-level indentation.
<DocList type="check" size={11} indentStep={0.4}> <DocListItem>Top-level item</DocListItem> <DocListItem level={1}>Nested one level deeper</DocListItem> <DocListItem level={1}>Sibling at the nested level</DocListItem> <DocListItem>Back to root</DocListItem></DocList><DocList> prop |
Type | Default |
|---|---|---|
type |
'disc' | 'number' | 'check' | 'arrow' | 'none' |
'disc' |
size |
points | inherits body size |
indentStep |
inches | 0.4 |
<DocListItem> prop |
Type | Default |
|---|---|---|
level |
0 | 1 | 2 | 3 |
0 |
type |
per-item bullet override | inherits from list |
<DocTable>
Section titled “<DocTable>”Data table with optional header, zebra rows, and column widths.
<DocTable header={['Bet', 'Owner', 'Status']} rows={[ ['Tokens', 'design', 'shipped'], ['Docs', 'docs guild', 'in flight'], ]} colWidths={[2.0, 2.0, 2.0]} // inches striped bordered caption="Tracked in the planning doc"/><DocImage>
Section titled “<DocImage>”Inline image. The exporter fetches the source and inlines it as base64. SVGs are exported as SVG with a tiny PNG fallback for legacy Word.
<DocImage src="/architecture.svg" alt="System diagram" w={6} // inches h={3.5} align="center" caption="High-level architecture"/>CORS matters — the source must be reachable from the page that runs the
export. Local assets (/foo.png) work; cross-origin images need
appropriate Access-Control-Allow-Origin headers.
<DocCodeBlock>
Section titled “<DocCodeBlock>”Mono-font block with light shading. Preserves whitespace and newlines.
<DocCodeBlock language="ts"> {`import { exportToDocx } from '@helix-ui/document';\n\nawait exportToDocx(<Brief />);`}</DocCodeBlock><DocBlockquote>
Section titled “<DocBlockquote>”Pull-quote with a colored left border and optional citation.
<DocBlockquote cite="— design lead, kickoff memo"> If a model can introspect the system as easily as a human reads it, the system grows itself.</DocBlockquote><DocHorizontalRule>
Section titled “<DocHorizontalRule>”Standard thematic break.
<DocHorizontalRule /><DocPageBreak>
Section titled “<DocPageBreak>”Force a new page mid-flow without starting a new section.
<Heading level={2}>Appendix</Heading><DocPageBreak /><Paragraph>Starts on its own page.</Paragraph>Color references
Section titled “Color references”Every color / highlight prop accepts:
- a theme key —
'brand' | 'success' | 'warning' | 'danger' | 'neutral' | 'ink' | 'paper' | 'subtle' | 'border' | 'accent' - a CSS variable —
'--helix-ui-color-...' - any CSS color string —
'#3b82f6','rgb(...)','oklch(...)'
The DOM preview honors them as CSS values. The DOCX exporter resolves them to concrete hex via a hidden canvas.