Skip to content

GemImage

The image component embeds image on a page.

Usage Example

/* (c) https://github.com/MontiCore/monticore */
package example_basic;

import mc.fenix.basic.GemImage;
import mc.fenix.arrange.GemCard;
import common.ExamplePage;
import mc.fenix.arrange.GemColumn;

page GemImageExample() {
  @ExamplePage(
    component = @GemColumn(components = [
      @GemCard(component =
        @GemImage(
          source = "assets/images/World.png",
          alt = "Image of the Earth"
        )
      ),

      @GemImage(
        width = "300px",
        source = "assets/images/World.png",
        alt = "Image of the Earth"
      ),

      @GemImage(
        height = "300px",
        source = "assets/images/World.png",
        alt = "Image of the Earth"
      ),

      @GemImage(
        width = "30px",
        height = "30px",
        source = "assets/images/World.png",
        alt = "Image of the Earth"
      )
    ]),
    basePath = "example_basic",
    componentName = "GemImageExample"
  );
}
GemImageExample

GUI Model

component GemImage(
  String height = "auto",
  String width = "auto",
  String source,
  String alt = "",
  String style = ""
)
Name Type Description Default value
height String Height of the component in px, %, vh. By default takes up all available space while preserving aspect ratio. "auto"
width String Width of the component in px, %, vh. By default takes up all available space while preserving aspect ratio. "auto"
source String The path to the image file. It can be a URL or a relative path. The relative path starts from the root folder (typically src/).
alt String The text that is shown if image could not be loaded. ""
style String Deprecated. ""