Add Custom Styles to an RTE Field in AEM (Adobe Experience Manager) with Examples

Anshul Agarwal
4 min readSep 20, 2023

Adobe Experience Manager (AEM) is a powerful content management solution that allows businesses to create, manage, and deliver digital experiences across various channels.

One essential feature of AEM is the Rich Text Editor (RTE), which enables content authors to create and format text-based content easily. While AEM offers a set of default styles for the RTE, customizing these styles allows you to tailor the editor to match your brand guidelines and enhance the authoring experience.

In this article, we’ll guide you through the process of creating custom styles for an RTE field in AEM with practical examples.

Step 1: Accessing the AEM Environment

Before you begin customizing RTE styles, ensure you have access to an AEM environment. This environment should have a configured RTE component where you can apply your custom styles or create a component with RTE dialog fields. Log in to the AEM instance using your credentials to proceed.

Step 2: Identifying/Creating the RTE Component

Once you’ve logged in, navigate to the AEM page where you want to customize the RTE styles. Identify the RTE component on the page and locate its corresponding dialog box. This dialog box will be used to define the custom styles for the RTE.

Component

Step 3: Understanding the RTE Dialog Configuration

To create custom styles, you need to understand the RTE dialog configuration. The dialog typically consists of the following sections:

a. Toolbar Configuration:

This section allows you to define the formatting options available in the RTE toolbar, such as bold, italic, underline, etc.

b. Styles Configuration:

In this section, you can define custom styles that authors can apply to text. These styles can include custom font families, font sizes, colors, and other formatting options.

c. CSS Classes Configuration:

Here, you can define CSS classes that authors can apply to content elements. This offers more flexibility and control over the RTE styles.

Step 4: Defining Custom Styles

Let’s walk through an example of how to define custom styles for an RTE in AEM:

Example: Custom bullet Style

Suppose you want to create a custom style for a text to change the font size.

  1. Open the RTE dialog configuration for your component.

2. Navigate to the “Styles Configuration” section.

3. Add a new style with a descriptive name like “Bullet Style.”

4. Define the CSS properties for the “Bullet Style” style. For example:

css

.bullet-style {

font-size: 3rem;

}

5. Save the changes to the RTE dialog configuration.

Step 5: Applying Custom Styles

After defining the custom style, authors can now use it to format content within the RTE:

  1. Go to the AEM page with the RTE component.

2. Open the RTE and highlight the text you want to format.

3. From the RTE toolbar, select the “Styles” drop-down, and you should see your newly created “Add Bullet Style” style.

4. Apply the “Bullet Style” style to the selected text.

5. Save the content, and the RTE will render the text with the custom bullet style.

Step 6: Testing and Refining

Test your custom styles thoroughly to ensure they appear as expected and don’t conflict with other components or styles on your website. Iterate and refine your custom styles as necessary to achieve the desired appearance and usability.

Conclusion

Customizing RTE styles in Adobe Experience Manager offers content authors a more personalized and brand-compliant authoring experience. By following the steps outlined in this article and leveraging the examples provided, you can create a more engaging and visually appealing content creation process for your AEM users. With custom styles, you can enhance the overall consistency and aesthetics of your website while empowering content authors to deliver a compelling digital experience.

Hope you find this article informative and helpful. Share with your friends and lets grow together.

Do follow me for more such articles.

Have a great day ahead! Thank you!!

--

--

Anshul Agarwal

AEM Developer | Content Creator on AEM Sites | Sometimes an Artist.