Control paragraph and heading alignment for professional document layouts. Perfect Word import/export compatibility for all alignment options.

OOXML Structure

<w:p>
  <w:pPr>
    <w:jc w:val="center"/>
  </w:pPr>
  <w:r>
    <w:t>Centered text</w:t>
  </w:r>
</w:p>

Why you’d use this

  • Titles & Headings - Center important headings for emphasis
  • Quotes - Right-align attributions or center block quotes
  • Formal Documents - Justify body text for professional appearance
  • Letters - Right-align dates and signatures
  • Poetry - Center verses for artistic presentation

Options

Configure the extension behavior:
types
Array.<string>
default:"['heading', 'paragraph']"
Node types to apply alignment to
alignments
Array.<string>
default:"['left', 'center', 'right', 'justify']"
Available alignment options
defaultAlignment
string
default:"'left'"
Default text alignment
Usage:
TextAlign.configure({
  resizable: false,
  cellMinWidth: 50
})

Attributes

textAlign
string
default:"'left'"
Text alignment value (left, center, right, justify)

Commands

setTextAlign

Set text alignment
Applies to all configured node types (heading, paragraph by default)
// Set to center
setTextAlign('center')

// Set to justify
setTextAlign('justify')
Parameters:
alignment
string
required
Alignment value (left, center, right, justify)

unsetTextAlign

Remove text alignment (reset to default)
Resets alignment to the default value
unsetTextAlign()

Keyboard Shortcuts

CommandShortcutDescription
setTextAlign(‘left’)()⌘/Ctrl-Shift-lAlign text left
setTextAlign(‘center’)()⌘/Ctrl-Shift-eAlign text center
setTextAlign(‘right’)()⌘/Ctrl-Shift-rAlign text right
setTextAlign(‘justify’)()⌘/Ctrl-Shift-jJustify text