Skip to content

Letterhead ​

Render a centered company header for formal correspondence.

Import ​

ts
import { letterheadPlugin, type LetterheadOptions } from 'docx-kit'

Options ​

OptionTypeDefaultDescription
companyNamestringrequiredPrimary brand or company name
taglinestring—Optional secondary line below the name
phonestring—Contact row item
emailstring—Contact row item
websitestring—Contact row item
addressstring—Final address line before the rule

Example ​

ts
import { createDocx, letterheadPlugin } from 'docx-kit'

const doc = createDocx()
  .use(letterheadPlugin())
  .plugin('letterhead', {
    companyName: 'Acme Corp',
    tagline: 'Designing reliable document systems',
    phone: '+1 555 0100',
    email: 'info@acme.com',
    website: 'acme.com',
    address: '1 Market Street, San Francisco, CA',
  })

Notes ​

  • The plugin finishes with a blue bottom rule so the body content can start immediately underneath.
  • Contact details are automatically joined into a single centered line.

Style customization ​

Pass { styles } to the factory for instance defaults, and options.styles for invocation overrides. The package and docx-kit entry points export LetterheadConfig and LetterheadStyles. 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.

PartsStyle typeScope
address, companyName, contact, taglineTextStyleRuleRun typography
addressParagraph, companyParagraph, contactParagraph, ruleParagraph, taglineParagraphParagraphStyleRuleBackground, borders, alignment, spacing and flow
ts
letterheadPlugin({
  styles: { companyName: { 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.

Released under the MIT License.