Brightspot CMS Developer Guide

Rich text toolbar

To deploy a rich-text toolbar, you define it as a class and then assign the class to a field.

You can deploy customized rich-text editors that have certain controls for marking up text. For example, the following class provides only the boldface, italics, underline, and hyperlink buttons.

Sample rich text editor
import com.psddev.cms.rte.RichTextToolbar;
import com.psddev.cms.rte.RichTextToolbarItem;
import com.psddev.cms.rte.RichTextToolbarStyle;

public class CustomRichTextToolbar implements RichTextToolbar { 1

    public List<RichTextToolbarItem> getItems() { 2
        return Arrays.asList(
  • Specifies a class that implements RichTextToolbar.
  • Specifies the controls appearing in the toolbar.

You associate a customized rich-text editor with a text field using the @ToolUi.RichText annotation.

Associating a customized rich-text editor to a field
import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.RichText(toolbar=CustomRichTextToolbar.class) 1

    private String body;

  • Applies the toolbar class created in Defining a toolbar class to the rich-text field body.

The following classes have controls which can be used in your customized rich-text toolbar’s getItems method:

See also:

  • Rendering rich text
  • Rich-text elements