Skip to main content

Supported Components

mjml-java implements all 31 top-level MJML v4 renderable components. Each component listed below links to the official MJML documentation for attribute details, behavior, and visual examples.

Head Components

ComponentDescriptionMJML Docs
mj-headContainer for head elements (title, fonts, styles, attributes)MJML Docs
mj-titleSets the document <title> tagMJML Docs
mj-previewSets the email preview text (preheader)MJML Docs
mj-fontRegisters a web font via @import or <link>MJML Docs
mj-breakpointSets the responsive breakpoint widthMJML Docs
mj-styleAdds CSS to the document <head> or inlines itMJML Docs
mj-attributesDefines default attribute values for componentsMJML Docs
mj-html-attributesAdds custom HTML attributes to rendered elementsMJML Docs

Body Layout Components

ComponentDescriptionMJML Docs
mj-bodyRoot body container; sets the email content widthMJML Docs
mj-sectionFull-width row container for columnsMJML Docs
mj-columnColumn within a section (auto-sized or explicit width)MJML Docs
mj-groupGroups columns to prevent stacking on mobileMJML Docs
mj-wrapperFull-width wrapper around multiple sectionsMJML Docs

Content Components

ComponentDescriptionMJML Docs
mj-textRich text content blockMJML Docs
mj-imageResponsive image with optional linkMJML Docs
mj-buttonCall-to-action button with linkMJML Docs
mj-dividerHorizontal rule / separator lineMJML Docs
mj-spacerVertical spacing elementMJML Docs
mj-tableHTML table passthroughMJML Docs
mj-rawRaw HTML passthrough (not processed by MJML)MJML Docs

Interactive Components

ComponentDescriptionMJML Docs
mj-heroHero section with background image and overlay contentMJML Docs
mj-accordionExpandable/collapsible content sectionsMJML Docs
mj-accordion-elementSingle item within an accordionMJML Docs
mj-accordion-titleTitle (clickable header) of an accordion elementMJML Docs
mj-accordion-textBody content of an accordion elementMJML Docs
mj-carouselImage carousel / slideshowMJML Docs
mj-carousel-imageSingle image within a carouselMJML Docs
mj-navbarHorizontal navigation barMJML Docs
mj-navbar-linkSingle link within a navbarMJML Docs
mj-socialSocial media icon groupMJML Docs
mj-social-elementSingle social media icon/linkMJML Docs

Include Support

In addition to the 31 components above, mjml-java supports mj-include for splitting templates across files:

<mj-include path="./header.mjml" />
<mj-include path="./styles.mjml" type="css" />
<mj-include path="./styles.mjml" type="css" css-inline="inline" />

Include resolution requires configuring an IncludeResolver:

MjmlConfiguration config = MjmlConfiguration.builder()
.includeResolver(new FileSystemIncludeResolver(Path.of("/templates")))
.build();

Custom Components

You can register custom components alongside the built-in ones:

MjmlConfiguration config = MjmlConfiguration.builder()
.registerComponent("mj-custom", (node, globalCtx, renderCtx) -> {
return new MyCustomComponent(node, globalCtx, renderCtx);
})
.build();

Custom body components extend BodyComponent and implement the render() method. Custom head components extend HeadComponent and implement the process() method.

Note: MJML control/helper tags such as mj-all, mj-class, mj-selector, and mj-html-attribute are supported as part of attribute processing, but they are not counted as top-level renderable components.

For component attributes, behavior, and visual examples, see the official MJML documentation.