Left, Center, Right -- Can the text alignment button be added to Redactor 2, and if so, how?


You can use the formattingAdd config setting to add custom formatting to the "Format" dropdown.

formattingAdd: {
  "align-left": {
    "title": "Align left",
    "args": ["p","class","align-left"],
  "align-right": {
    "title": "Align right",
    "args": ["p","class","align-right"],
  "align-center": {
    "title": "Align center",
    "args": ["p","class","align-center"],
  "align-justify": {
    "title": "Justify",
    "args": ["p","class","align-justify"],

If you want to have a separate dropdown or individual buttons in the toolbar for this functionality, have a look at my plugin Redactor Inline Styles.

| improve this answer | |
  • carlcs - After a comparison, I would recommend your RedactorInlineStyles plugin to anyone wanting to return Redactor within Craft to its former glory. The documentation and examples you include with the plugin are great and really made it easy to configure. – Davis Harrison Dion Jan 21 '16 at 15:58

Either existing answer could work.

Another option is a plugin I've recently built. Redactor Extras: https://github.com/elliotlewis/Redactor-Extras

Uses the Plugin from Redactors site for align. Has other extras as well.

| improve this answer | |
  • great plugin. quick and easy to install and get stuff happening. thanks! – bhu Boue vidya May 10 '17 at 1:10

Thank you.

I also discovered this plugin which allows the addition of styles to the redactor editor.



enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.