Class MjCarouselImage


public class MjCarouselImage extends BodyComponent
A single image in a carousel (<mj-carousel-image>). Renders an image element with an optional link wrapper. The thumbnails-src attribute can specify an alternate thumbnail image for the carousel navigation.

When rendered by the parent MjCarousel, each image produces output like:

<a href="HREF" target="TARGET">
  <img title="TITLE" src="SRC" alt="ALT"
       style="border-radius:RADIUS;display:block;width:WIDTHpx;max-width:100%;height:auto;"
       width="WIDTH_INT" border="0" />
</a>
  • Constructor Details

  • Method Details

    • getTagName

      public String getTagName()
      Description copied from class: BaseComponent
      Returns the MJML tag name this component handles.
      Specified by:
      getTagName in class BaseComponent
      Returns:
      the MJML tag name
    • getDefaultAttributes

      public Map<String,String> getDefaultAttributes()
      Description copied from class: BaseComponent
      Returns the default attribute values for this component.
      Specified by:
      getDefaultAttributes in class BaseComponent
      Returns:
      a map of attribute names to their default values
    • renderImage

      public String renderImage(String borderRadius, int width)
      Renders this carousel image. The parent MjCarousel calls this method and wraps the result in the appropriate carousel image div.
      Parameters:
      borderRadius - the border-radius inherited from the parent mj-carousel
      width - the pixel width of the image (container width)
      Returns:
      the rendered HTML for this image
    • render

      public String render()
      Description copied from class: BodyComponent
      Renders this component to HTML.
      Specified by:
      render in class BodyComponent
      Returns:
      the rendered HTML string