Back to Mjml

README

packages/mjml-carousel/README.md

5.1.05.6 KB
Original Source

Displays a gallery of images or "carousel". Readers can interact by hovering and clicking on thumbnails depending on the email client they use.

<figure> </figure>
xml
<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-carousel>
          <mj-carousel-image src="https://static.mailjet.com/mjml-website/documentation/carousel-1.jpg" />
          <mj-carousel-image src="https://static.mailjet.com/mjml-website/documentation/carousel-2.jpg" />
          <mj-carousel-image src="https://static.mailjet.com/mjml-website/documentation/carousel-3.jpg" />
        </mj-carousel>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

Attributes

attributeacceptsdescriptiondefault value
alignleft center righthorizontal alignmentcenter
border-radiusstringborder radius6px
container-background-colorCSS color formatscolumn background color
css-classstringclass name, added to the root HTML element created
icon-widthpx %width of the icons on left and right of the main image44px
left-iconstringicon on the left of the main imagehttps://i.imgur.com/xTh3hln.png
paddingpx %carousel padding, supports up to 4 parameters
padding-bottompx %carousel bottom padding
padding-leftpx %carousel left padding
padding-rightpx %carousel right padding
padding-toppx %carousel top padding
right-iconstringicon on the right of the main imagehttps://i.imgur.com/os7o9kz.png
tb-borderstringborder of the thumbnails in CSS border format2px solid transparent
tb-border-radiusstringborder-radius of the thumbnails6px
tb-hover-border-colorCSS color formatsborder color of the hovered thumbnail#fead0d
tb-selected-border-colorCSS color formatsborder color of the selected thumbnail#ccc
tb-widthpx %thumbnail width
thumbnailsvisible hidden supporteddisplay the thumbnailshidden
<p class="cta-container"><a class="cta" href="https://mjml.io/try-it-live/components/carousel">Try it live</a></p>

mj-carousel-image

Enables you to add and style the images in the carousel.

<div class="alert alert-note" role="alert"> <p>Note</p> <p><code>mj-carousel-image</code> is an "ending tag", which means that it can contain HTML code but it cannot contain other MJML components.</p> <p>More information about ending tags <a href="#ending-tags">in this section</a>.</p> </div>

Attributes

attributeacceptsdescriptiondefault value
altstringimage description''
border-radiusstringborder radius of the main image
css-classstringclass name, added to the root HTML element created
hrefstringlink to redirect to on click,
URL format
relstringspecify the rel attribute
srcstringURL format
targetstringlink target on click_blank
tb-borderstringCSS border format
tb-border-radiusstringborder radius of the thumbnail
thumbnails-srcstringspecify a different thumbnail image in URL format
titlestringtooltip & accessibility