🎈 Welcome to the Marketplace — Explore and discover the ecosystem around DatoCMS, and share your own work with the community!

Custom Text Styles

A DatoCMS plugin that gives you the ability to have custom styles for Structured Text Fields.

This is a Community Plugin!  Learn how create your own plugin, or copy and remix existing ones in our documentation

DatoCMS plugin: Custom Text Styles

This DatoCMS plugin adds custom styles and marks to the editor of Structured Text fields. You define them with CSS in the plugin settings, and editors pick them from the toolbar.

preview of Custom Text Styles plugin

Features

  • Add custom styles (for headings and paragraphs) to the Structured Text editor
  • Add custom marks (inline styles) to the Structured Text editor
  • Choose which styles and marks are available per field, so per block
  • Render the styles and marks on your front end as CSS classes

Configuration

Plugin Settings

Custom Styles

Add your own Custom Styles. You can set the following attributes:

Slug

Set this slug to what you want your final css class to be. Please Note: Upon changing this property, you will have to update all Structured Text Fields already used in DatoCMS.

Title

This title will be shown in the DatoCMS Structured Text editor.

Node

For now, you can choose between heading and paragraph

CSS

This is the CSS shown in the DatoCMS Structured Text editor Settings for Styles in Custom Text Styles plugin

Custom Marks

Add your own Custom Marks (inline styles). You can set the following attributes:

Slug

Set this slug to what you want your final css class to be. Please Note: Upon changing this property, you will have to update all Structured Text Fields already used in DatoCMS.

Title

This title will be shown in the DatoCMS Structured Text editor.

Icon

You can set an icon name based on the icons available from fontawesome free icons

Keyboard Shortcut

You can set a keyboard shortcut you can use inside the DatoCMS Structured Text editor.

CSS

This is the CSS shown in the DatoCMS Structured Text editor Settings for marks in Custom Text Styles plugin

Per-field settings

By default all styles and marks are available in every Structured Text field. With the Custom Text Styles field add-on you pick which ones each field gets.

Field add-on preview

See Per-field settings for the steps, an example and how the add-on works.

Front end

Custom styles are stored as the style property of a paragraph or heading node. Custom marks are stored in the marks array of a span node. Both hold the slug from the plugin settings.

{
"type": "paragraph",
"style": "centered",
"children": [
{
"type": "span",
"value": "This text is centered, and "
},
{
"type": "span",
"marks": ["shout"],
"value": "this part shouts"
}
]
}

Your front end has to turn those slugs into CSS classes. Pick your framework for a complete example:

Both examples render the JSON above as:

<p>This text is centered, and <strong>this part shouts</strong></p>

For other frameworks, see the DatoCMS docs on custom styles and custom marks.

Contributing

See contributing.md.

Subscribe to our newsletter! 📥
One update per month. All the latest news and sneak peeks directly in your inbox.
support@datocms.com ©2026 Dato srl, all rights reserved P.IVA 06969620480