🎈 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 makes it possible to add custom styles to the editor of Structured text fields by setting css properties. You can add as many styles as you'd like in the Plugin settings. preview of Custom Text Styles plugin

Features

  • Add custom styles to editor of Structured Text Fields
  • Add custom CSS class names to rendered nodes in your Structured Text Fields

Configuration

Plugin Settings

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 Custom Text Styles plugin

Front End Structured Text Implementation

Nodes inside Structured Text will be rendered with a style attribute corresponding with the Slug set in the Plugin Settings. (See more info from DatoCMS)[https://www.datocms.com/docs/plugin-sdk/structured-text-customizations#adding-custom-styles-to-nodes]

{
"type": "paragraph",
"style": "stand-out",
"children": [
{
"type": "span",
"value": "This is a stand out"
}
]
},

Update your front end so that you attribute the style property as a CSS class.

// example of a possible implementation of a Paragraph Node
---
import type { Paragraph } from 'datocms-structured-text-utils';
interface Props {
node: Paragraph;
}
const { node } = Astro.props;
---
// Style attribute ('shout-out') will be accesible from the node
// Paragraphs that have a custom style of 'Shout Out' will have the css class 'shout-out'
<p>&lt;slot /&gt;</p>
<p> This is a Shout Out</p>

You can now proceed to implement your own custom CSS for the shout-out class

p.shout-out {
font-size: 24px;
color: pink;
}
Subscribe to our newsletter! 📥
One update per month. All the latest news and sneak peeks directly in your inbox.
support@datocms.com ©2025 Dato srl, all rights reserved P.IVA 06969620480