Class FontIcon
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.ClickNotifier<FontIcon>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.shared.HasTooltip,Serializable
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbindCharCode(com.vaadin.flow.signals.Signal<String> signal) Binds the given signal to the character code of the font icon.voidbindLigature(com.vaadin.flow.signals.Signal<String> signal) Binds the given signal to the ligature name of the font icon.Gets the hexadecimal code point that specifies a glyph from an icon font.getColor()Gets the color of this icon as a String.Gets the font family to use for the font icon.String[]Gets the icon class names defining an icon font and/or a specific glyph inside an icon font.Gets the ligature name that specifies an icon from an icon font with support for ligatures.voidsetCharCode(String charCode) Sets the hexadecimal code point that specifies a glyph from an icon font.voidSets the color of the icon.voidsetFontFamily(String fontFamily) Sets the font family to use for the font icon.voidsetIconClassNames(String... iconClassNames) Sets the icon class names defining an icon font and/or a specific glyph inside an icon font.voidsetLigature(String ligature) Sets the ligature name that specifies an icon from an icon font with support for ligatures.Methods inherited from class com.vaadin.flow.component.icon.AbstractIcon
setSizeMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipText
-
Constructor Details
-
FontIcon
public FontIcon()Default constructor. Creates an empty font icon. -
FontIcon
Creates a font icon component with the given icon class names. Example:new FontIcon("fa-solid", "fa-user").- Parameters:
iconClassNames- The icon class names, not null- See Also:
-
-
Method Details
-
setIconClassNames
Sets the icon class names defining an icon font and/or a specific glyph inside an icon font. Example:setIconClassNames("fa-solid", "fa-user").- Parameters:
iconClassNames- The icon class names, not null
-
getIconClassNames
Gets the icon class names defining an icon font and/or a specific glyph inside an icon font.- Returns:
- The icon class names
-
setFontFamily
Sets the font family to use for the font icon.- Parameters:
fontFamily- the font family to use
-
getFontFamily
Gets the font family to use for the font icon.- Returns:
- the font family to use
-
setCharCode
Sets the hexadecimal code point that specifies a glyph from an icon font. Example:setCharCode("e001")- Parameters:
charCode- the character code to use
-
getCharCode
Gets the hexadecimal code point that specifies a glyph from an icon font.- Returns:
- the character code to use
-
bindCharCode
Binds the given signal to the character code of the font icon.When a signal is bound, the character code is kept synchronized with the signal value while the component is attached. When the component is detached, signal value changes have no effect.
While a signal is bound, any attempt to set the character code manually through
setCharCode(String)throws aBindingActiveException.- Parameters:
signal- the signal to bind the character code to, notnull- Since:
- 25.1
- See Also:
-
setLigature
Sets the ligature name that specifies an icon from an icon font with support for ligatures. Example:setLigature("home")- Parameters:
ligature- the ligature to use
-
getLigature
Gets the ligature name that specifies an icon from an icon font with support for ligatures.- Returns:
- the ligature to use
-
bindLigature
Binds the given signal to the ligature name of the font icon.When a signal is bound, the ligature name is kept synchronized with the signal value while the component is attached. When the component is detached, signal value changes have no effect.
While a signal is bound, any attempt to set the ligature manually through
setLigature(String)throws aBindingActiveException.- Parameters:
signal- the signal to bind the ligature to, notnull- Since:
- 25.1
- See Also:
-
setColor
Description copied from class:AbstractIconSets 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:
setColorin classAbstractIcon<FontIcon>- Parameters:
color- the color to set, may benullto clear the value
-
getColor
Description copied from class:AbstractIconGets the color of this icon as a String.- Specified by:
getColorin classAbstractIcon<FontIcon>- Returns:
- the color of the icon, or
nullif the color has not been set
-