Skip to main content

Alignment

The alignment plugin enables support for text alignment. You can use it to align your content to left, right, center or to justify it.

Installation#

npm install @udecode/plate-alignment
npm install @udecode/plate-alignment-ui

Usage#

Click inside a paragraph or a header and click on a toolbar button to apply the desired text alignment.

Live Editor
Result
SyntaxError: Unexpected token (1:8)
1 : return ()
            ^

Options#

types#

  • List of block types supporting alignment.
  • Default is the paragraph type.

alignments#

  • List of supported text-align values.
  • Default is ['left', 'center', 'right', 'justify']

defaultAlignment#

  • Default alignment will not be set to the node
  • Default is 'left'

classNames#

  • By default, the plugin is setting an inline style with text-align CSS property.
  • If you want more semantic content that uses classes instead, you can specify class names and style them by using a style sheet.

Source Code#