Signature Block
Renders signature lines for contracts, approvals, and formal documents. Each party gets a cell in a borderless table with a bold label, signature line, and optional date.
Import
import { signatureBlockPlugin, type SignatureBlockOptions, type SignatureParty } from 'docx-kit'Options
| Option | Type | Default | Description |
|---|---|---|---|
parties | SignatureParty[] | (required) | The signing parties |
columns | number | 2 | Maximum columns, capped at the number of parties |
SignatureParty
| Field | Type | Description |
|---|---|---|
label | string | Party label (e.g. "甲方(盖章)") |
date | string | Pre-filled date (e.g. "2026年 月 日") |
name | string | Pre-filled name (shown underlined when provided) |
Examples
Two-Party Contract
import { createDocx, signatureBlockPlugin } from 'docx-kit/node'
const doc = createDocx()
.use(signatureBlockPlugin())
.h1('Service Agreement')
.p('The parties agree to the following terms and conditions...')
.p('Signed:')
.plugin('signatureBlock', {
parties: [
{ label: '甲方(盖章)', name: '张三', date: '2026年 月 日' },
{ label: '乙方(盖章)', name: '李四', date: '2026年 月 日' },
],
})
.save('contract.docx')Three-Column Layout
const doc = createDocx()
.use(signatureBlockPlugin())
.h1('Approval Sheet')
.plugin('signatureBlock', {
columns: 3,
parties: [
{ label: '申请人', name: '王五' },
{ label: '部门经理', date: '2026年 月 日' },
{ label: '总经理', date: '2026年 月 日' },
],
})
.save('approval.docx')Without Pre-Filled Names
const doc = createDocx()
.use(signatureBlockPlugin())
.h1('NDA Agreement')
.plugin('signatureBlock', {
parties: [
{ label: 'Disclosing Party', date: 'Date: ____________' },
{ label: 'Receiving Party', date: 'Date: ____________' },
],
})
.save('nda.docx')Single Party
const doc = createDocx()
.use(signatureBlockPlugin())
.h1('Acknowledgment Form')
.p('I acknowledge that I have received and read the employee handbook.')
.plugin('signatureBlock', {
parties: [
{ label: 'Employee Signature', name: 'Jane Smith', date: '2026-06-11' },
],
})
.save('acknowledgment.docx')Four Parties in Two Rows
const doc = createDocx()
.use(signatureBlockPlugin())
.h1('Multi-Party Agreement')
.plugin('signatureBlock', {
columns: 2,
parties: [
{ label: 'Party A', name: 'Alice', date: '2026-06-11' },
{ label: 'Party B', name: 'Bob', date: '2026-06-11' },
{ label: 'Party C', name: 'Carol', date: '2026-06-11' },
{ label: 'Party D', name: 'David', date: '2026-06-11' },
],
})
.save('multi-party.docx')Style customization
Pass { styles } to the factory for instance defaults, and options.styles for invocation overrides. The package and docx-kit entry points export SignatureBlockConfig and SignatureBlockStyles. Priority: built-in/theme defaults → initialization styles → common node style → invocation part styles. Nested fields merge; arrays replace; undefined retains defaults; 0 and false apply. Units and theme tokens such as $colors.primary are supported.
| Parts | Style type | Scope |
|---|---|---|
date, emptyText, label, signature | TextStyleRule | Run typography |
dateParagraph, emptyParagraph, labelParagraph, paddingParagraph, signatureParagraph | ParagraphStyleRule | Background, borders, alignment, spacing and flow |
cell | Omit<CellStyleRule, 'height'> | Cell shading, borders, width and padding |
signatureBlockPlugin({
styles: { signature: { color: '#2563EB', fontSize: 14 } },
})Use the same part names in options.styles for a single call. JSON DSL, AI tool schemas and MCP validation share these contracts; unknown parts and misplaced properties are rejected.