A typographical logo of Contenido.

Text Alignment

Text alignment is used to display your content in your desired appearance.

toggleTextAlign #

In order to toggle between different text alignment, you can use toggleTextAlign utility.

You can completely create your custom keys for the text alignments. Here are the default ones:

  • text-align-left
  • text-align-center
  • text-align-right
  • text-align-justify

The default value for toggleTextAlign is text-align-right.

Alignment detection #

You can find the text alignment with these utilities:

  • isTextLeftAligned
  • isTextRightAligned
  • isTextCenterAligned
  • isTextJustifyAligned

Block style function #

When you add custom block types to your content, you need to define a utility to detecet and style the block type in the way you want. blockStyleFn is a ready to use utility that should be used whenever you need to render alignment or blockquotes properly.

Example #

An example of text alignment:

Made with ❤ for a better experience

MIT © 2023 - This site does not track you.