Class Icon

All Implemented Interfaces:
AttachNotifier, ClickNotifier<Icon>, DetachNotifier, HasElement, HasStyle, HasTooltip, Serializable

@NpmPackage(value="@vaadin/icons", version="24.3.11") @JsModule("@vaadin/icons/vaadin-iconset.js") public class Icon extends AbstractIcon<Icon>
Component for displaying an icon from the Vaadin Icons collection.
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • Icon

      public Icon()
      Creates an Icon component that displays a Vaadin logo.
    • Icon

      public Icon(VaadinIcon icon)
      Creates an Icon component that displays the given icon from VaadinIcon.
      Parameters:
      icon - the icon to display
    • Icon

      public Icon(String icon)
      Creates an Icon component that displays the given icon from vaadin-icons collection.
      Parameters:
      icon - the icon name
    • Icon

      public Icon(String collection, String icon)
      Creates an Icon component that displays the given icon from the given collection. If you want to use a custom <vaadin-iconset> -based icon set, you also need to add a dependency and an import for it, example:
       
       @NpmPackage(value = "custom-icons", version = "1.0.0")
       @JsModule("custom-icons/iconset.js")
       public class MyView extends Div {
       
       
      Parameters:
      collection - the icon collection
      icon - the icon name
  • Method Details

    • setColor

      public void setColor(String color)
      Description copied from class: AbstractIcon
      Sets the color of the icon.

      The color should be in a format understood by the browser, e.g. "orange", "#FF9E2C" or "rgb(255, 158, 44)".

      Specified by:
      setColor in class AbstractIcon<Icon>
      Parameters:
      color - the color to set, may be null to clear the value
    • getColor

      public String getColor()
      Description copied from class: AbstractIcon
      Gets the color of this icon as a String.
      Specified by:
      getColor in class AbstractIcon<Icon>
      Returns:
      the color of the icon, or null if the color has not been set