java.lang.Object
com.vaadin.flow.component.svg.elements.SvgElement
com.vaadin.flow.component.svg.elements.Text

public class Text extends SvgElement
Represents an SVG text element.
  • Constructor Details

    • Text

      public Text(String id, String text)
      Creates a new Text element with the given id and text.
      Parameters:
      id - the id for this text element
      text - the text to show for this text element
  • Method Details

    • setText

      public void setText(String text)
      Sets the visible text for this Text element.
      Parameters:
      text - the text to show
    • getText

      public String getText()
      Returns the current text on this text element.
      Returns:
      the current text on this text element.
    • setFontFamily

      public void setFontFamily(String fontFamily)
      Sets the font family to use for this Text element. Note that the browser must support the font that is specified here.

      This attribute can have multiple values (i.e. webfonts with fallback) for instance: setFontFamily("'Roboto', 'Noto', sans-serif");

      Parameters:
      fontFamily - the font family to use for this text element.
    • getFontFamily

      public String getFontFamily()
      Returns the current font family used for this Text element.
      Returns:
      the current font family
    • setFontSize

      public void setFontSize(String fontSize)
      Sets the font size of this text element, this can be in absolute (px) or relative (ex: em, ex) values.
      Parameters:
      fontSize - the font size to use
    • getFontSize

      public String getFontSize()
      Returns the font size for this text element.
      Returns:
      the font size or null if none set