@Tag(value="vaadin-icon") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="22.0.22") @NpmPackage(value="@vaadin/icons",version="22.0.22") @NpmPackage(value="@vaadin/vaadin-icons",version="22.0.22") @NpmPackage(value="@vaadin/icon",version="22.0.22") @NpmPackage(value="@vaadin/vaadin-icon",version="22.0.22") @JsModule(value="@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule(value="@vaadin/icons/vaadin-iconset.js") @JsModule(value="@vaadin/icon/vaadin-icon.js") public class Icon extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.ClickNotifier<Icon>
VaadinIcon,
Serialized Form| 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)
Creates an Icon component that displays the given
icon from the
given collection. |
Icon(VaadinIcon icon)
Creates an Icon component that displays the given icon from
VaadinIcon. |
| 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.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNamepublic Icon()
public Icon(VaadinIcon icon)
VaadinIcon.icon - the icon to displaypublic Icon(String icon)
icon - the icon namepublic Icon(String collection, String icon)
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 {
collection - the icon collectionicon - the icon namepublic void setSize(String size)
The size should be in a format understood by the browser, e.g. "100px" or "2.5em".
size - the size to set, may be null to clear the valuepublic void setColor(String color)
The color should be in a format understood by the browser, e.g. "orange", "#FF9E2C" or "rgb(255, 158, 44)".
color - the fill color to set, may be null to clear the
valuepublic String getColor()
null if the color has
not been setCopyright © 2023. All rights reserved.