com.vaadin.flow.component.icon.
Class Icon
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.icon.Icon
-
All Implemented Interfaces:
AttachNotifier, ClickNotifier<Icon>, DetachNotifier, HasElement, HasStyle, Serializable
@Tag(value="iron-icon") @NpmPackage(value="@vaadin/vaadin-icons", version="4.3.1") @JsModule(value="@vaadin/vaadin-icons/vaadin-icons.js") public class Icon extends Component implements HasStyle, ClickNotifier<Icon>
Component for displaying an icon from the Vaadin Icons collection.
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor and Description Icon()
Creates an Icon component that displays a Vaadin logo.
Icon(String icon)
Creates an Icon component that displays the given icon from vaadin-icons collection.
Icon(String collection, String icon)
Deprecated.
Use eitherIcon(String)
orIronIcon(String,String)
Icon(VaadinIcon icon)
Creates an Icon component that displays the given icon from
VaadinIcon
.
-
Method Summary
All Methods Modifier and Type Method and Description String
getColor()
Gets the fill color of this icon as a String.
void
setColor(String color)
Sets the fill color of the icon.
void
setSize(String size)
Sets the width and the height of the icon.
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
-
-
-
Constructor Detail
-
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
@Deprecated public Icon(String collection, String icon)
Deprecated. Use either
Icon(String)
orIronIcon(String,String)
Creates an Icon component that displays the given
icon
from the givencollection
.Parameters:
collection
- the icon collectionicon
- the icon name
-
-
Method Detail
-
setSize
public void setSize(String size)
Sets the width and the height of the icon.
The size should be in a format understood by the browser, e.g. "100px" or "2.5em".
Parameters:
size
- the size to set, may benull
to clear the value
-
setColor
public void setColor(String color)
Sets the fill color of the icon.
The color should be in a format understood by the browser, e.g. "orange", "#FF9E2C" or "rgb(255, 158, 44)".
Parameters:
color
- the fill color to set, may benull
to clear the value
-
getColor
public String getColor()
Gets the fill color of this icon as a String.
Returns:
the fill color of the icon, or
null
if the color has not been set
-
-