Plugins
docx-kit currently ships with 25 built-in plugins. Each plugin lives in its own workspace package under packages-plugins/, can be registered with .use(...), and is invoked through .plugin(name, options).
Catalog
| Plugin | Package | Node Name | Description |
|---|---|---|---|
| Cross Reference | @docxkit/plugin-cross-reference | crossReference | Bookmark text, number and page references |
| Bibliography | @docxkit/plugin-bibliography | bibliography | Numeric source lists and linked citations |
| Glossary | @docxkit/plugin-glossary | glossary | Sorted and grouped terminology tables |
| Badge | @docxkit/plugin-badge | badge | Status chips and short labels |
| Barcode | @docxkit/plugin-barcode | barcode | Code 128, EAN, UPC, and other linear barcodes |
| Callout | @docxkit/plugin-callout | callout | Info, warning, success, and danger boxes |
| Changelog | @docxkit/plugin-changelog | changelog | Release-note tables with typed entries |
| Code Block | @docxkit/plugin-code-block | codeBlock | Monospaced source blocks with optional highlighting |
| Cover Page | @docxkit/plugin-cover-page | coverPage | Professional title and report covers |
| Data Table | @docxkit/plugin-data-table | dataTable | Object-array tables with formatting helpers |
| Divider | @docxkit/plugin-divider | divider | Horizontal rules and section separators |
| ECharts | @docxkit/plugin-echarts | echarts | Embedded ECharts charts |
| Invoice | @docxkit/plugin-invoice | invoice | Invoice layouts with totals and tax calculation |
| Letterhead | @docxkit/plugin-letterhead | letterhead | Branded company headers for formal letters |
| Meeting Minutes | @docxkit/plugin-meeting-minutes | meetingMinutes | Structured meeting summaries |
| Page Number | @docxkit/plugin-page-number | pageNumber | Current page or page X of Y fields |
| Property Table | @docxkit/plugin-property-table | propertyTable | Key-value metadata tables |
| QR Code | @docxkit/plugin-qrcode | qrcode | QR code images from text or URLs |
| Checklist | @docxkit/plugin-checklist | checklist | Grouped native Word checkboxes |
| Figure | @docxkit/plugin-figure | figure | Images with captions and source credits |
| Metric Card | @docxkit/plugin-metric-card | metricCard | Multi-column metric summaries |
| Signature Block | @docxkit/plugin-signature-block | signatureBlock | Signature grids for approvals and contracts |
| Timeline | @docxkit/plugin-timeline | timeline | Chronological milestone rendering |
| Table of Contents | @docxkit/plugin-toc | toc | Word TOC fields based on headings |
| Watermark | @docxkit/plugin-watermark | watermark | Simple textual watermarks |
Shared Usage Pattern
ts
import { createDocx, calloutPlugin } from 'docx-kit'
const doc = createDocx()
.use(calloutPlugin())
.plugin('callout', {
type: 'info',
title: 'Heads up',
content: 'This report is generated automatically.',
})Compatibility Notes
| Plugin | Extra dependency or runtime note |
|---|---|
crossReference | Word fields need refreshing; previews use cached fallback text |
barcode | Requires the bwip-js package |
codeBlock | Optional highlight.js peer dependency for syntax coloring |
echarts | Requires echarts; browser DOM is the primary target |
qrcode | Requires the qrcode package |
toc | Word usually asks to update fields after opening the generated .docx |
pageNumber | Most useful when inserted into headers or footers |
How To Choose
- Use content plugins like
callout,codeBlock,badge, anddividerwhen you need presentational blocks inside a normal document flow. - Use document-structure plugins like
coverPage,toc,pageNumber, andletterheadwhen you want reusable report scaffolding. - Use data plugins like
dataTable,propertyTable,timeline,invoice, andmeetingMinuteswhen your source data already has a clear schema. - Use media plugins like
barcode,echarts, andqrcodewhen the document needs scannable or visual output.
Custom plugins are still supported through definePlugin(). See the Plugins guide and the package catalog for the package-level view.