Add custom styles to my Rich Text in SliceMachine?


I need to add custom styles to one of my rich text field which lives in my Slice Machine setup? How can I set it up? I want to do something like what this article is explaining


Hello Kris,

Thanks for posting this question to us.

You can achieve it by adding custom labels to richtext inside the model.json file of your project. The configuration of the labels field should be an array.

Lets's say you have a Rich Text field inside your slice of API ID as book_desc and you want to add labels in your Rich text fields. Go to your model.json file, find a field and add labels like:

"book_desc" : {
    "type" : "StructuredText",
       "config" : {
          "multi" : "paragraph, preformatted, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, o-list-item",
           "allowTargetBlank" : true,
            "label" : "Book Description",
             "labels" :  ["right-align", "center-align"]

Give this a try and let me know if you have any other doubts.



This is exactly what I needed - thank you!!!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.