Icon uses embedded font instead of pixel image. Comparing to image, Icon is easily scalable, color can be altered live and various effects can be added using css.
A set of built in Icons is available and they can be fetched by calling sap.ui.core.IconPool.getIconURI and set this value to the src property on the Icon.
Since: 1.11.1.
Event Summary
press(oControlEvent)This event is fired when icon is pressed/activated by the user. Method Summary
sap.ui.core.Icon.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.Icon with name sClassName
and enriches it with the information contained in oClassInfo
. addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy
. attachPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the press
event of this sap.ui.core.Icon
. detachPress(fnFunction, oListener)Detaches event handler fnFunction
from the press
event of this sap.ui.core.Icon
. firePress(mArguments?)Fires event press
to attached listeners. getAlt()Gets current value of property alt
. getAriaLabelledBy()Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
. getColor()Gets current value of property color
. getHeight()Gets current value of property height
. getSize()Gets current value of property size
. getSrc()Gets current value of property src
. getWidth()Gets current value of property width
. removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy
. setActiveColor(sActiveColor)Sets a new value for property activeColor
. setAlt(sAlt)Sets a new value for property alt
. setColor(sColor)Sets a new value for property color
. setDecorative(bDecorative)Sets a new value for property decorative
. setHeight(sHeight)Sets a new value for property height
. setHoverColor(sHoverColor)Sets a new value for property hoverColor
. setNoTabStop(bNoTabStop)Sets a new value for property noTabStop
. setSize(sSize)Sets a new value for property size
. setSrc(sSrc)Sets a new value for property src
. setWidth(sWidth)Sets a new value for property width
. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
invalidate,
isBusy,
onAfterRendering,
onBeforeRendering,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
exit,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
init,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.ui.core.Icon(sId?, mSettings?)
Constructor for a new Icon.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- Aggregations
- Events
- press : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
Parameters:
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
Event Detail
press(oControlEvent)
This event is fired when icon is pressed/activated by the user. When a handler is attached to this event, the Icon gets tab stop. If you want to disable this behavior, set the noTabStop property to true.
Parameters:
Method Detail
sap.ui.core.Icon.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.Icon with name
sClassName
and enriches it with the information contained in
oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.ui.core.Icon.
Returns:
Adds some ariaLabelledBy into the association ariaLabelledBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaLabelledBy | the ariaLabelledBy to add; if empty, nothing is inserted |
Returns:
Attaches event handler
fnFunction
to the
press
event of this
sap.ui.core.Icon
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.core.Icon
itself.
This event is fired when icon is pressed/activated by the user. When a handler is attached to this event, the Icon gets tab stop. If you want to disable this behavior, set the noTabStop property to true.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.core.Icon itself |
Returns:
Detaches event handler
fnFunction
from the
press
event of this
sap.ui.core.Icon
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Fires event press
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo} |
getActiveBackgroundColor(): string
Gets current value of property
activeBackgroundColor
.
Background color for Icon in active state.
Returns:
{string} | Value of property activeBackgroundColor |
getActiveColor(): string
Gets current value of property
activeColor
.
This color is shown when icon is pressed/activated by the user.
Returns:
{string} | Value of property activeColor |
getAlt(): string
Gets current value of property
alt
.
This defines the alternative text which is used for outputting the aria-label attribute on the DOM.
- Since:
- 1.30.0
Returns:
{string} | Value of property alt |
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
.
Returns:
getBackgroundColor(): string
Gets current value of property
backgroundColor
.
Background color of the Icon in normal state.
Returns:
{string} | Value of property backgroundColor |
getColor(): string
Gets current value of property
color
.
The color of the Icon. If color is not defined here, the Icon inherits the color from its DOM parent.
Returns:
{string} | Value of property color |
getDecorative(): boolean
Gets current value of property
decorative
.
A decorative icon is included for design reasons. Accessibility tools will ignore decorative icons. Tab stop isn't affected by this property anymore and it's now controlled by the existence of press event handler and the noTabStop property.
Default value is true
.
- Since:
- 1.16.4
Returns:
{boolean} | Value of property decorative |
Gets current value of property
height
.
This is the height of the DOM element which contains the Icon. Setting this property doesn't affect the size of the font. If you want to make the font bigger, increase the size property.
Returns:
getHoverBackgroundColor(): string
Gets current value of property
hoverBackgroundColor
.
Background color for Icon in hover state. This property has no visual effect when run on mobile device.
Returns:
{string} | Value of property hoverBackgroundColor |
getHoverColor(): string
Gets current value of property
hoverColor
.
This color is shown when icon is hovered. This property has no visual effect when run on mobile device.
Returns:
{string} | Value of property hoverColor |
getNoTabStop(): boolean
Gets current value of property
noTabStop
.
Defines whether the tab stop of icon is controlled by the existence of press event handler. When it's set to false, Icon control has tab stop when press event handler is attached. If it's set to true, Icon control never has tab stop no matter whether press event handler exists or not.
Default value is false
.
- Since:
- 1.30.1
Returns:
{boolean} | Value of property noTabStop |
Gets current value of property
size
.
Since Icon uses font, this property will be applied to the css font-size property on the rendered DOM element.
Returns:
Gets current value of property
src
.
This property should be set by the return value of calling sap.ui.core.IconPool.getIconURI with a Icon name parameter and an optional collection parameter which is required when using application extended Icons. A list of standard FontIcon is available here.
Returns:
getUseIconTooltip(): boolean
Gets current value of property
useIconTooltip
.
Decides whether a default Icon tooltip should be used if no tooltip is set.
Default value is true
.
- Since:
- 1.30.0
Returns:
{boolean} | Value of property useIconTooltip |
Gets current value of property
width
.
This is the width of the DOM element which contains the Icon. Setting this property doesn't affect the size of the font. If you want to make the font bigger, increase the size property.
Returns:
Removes all the controls in the association named ariaLabelledBy
.
Returns:
Removes an ariaLabelledBy from the association named ariaLabelledBy
.
Parameters:
{int|string|sap.ui.core.Control} | vAriaLabelledBy | The ariaLabelledByto be removed or its index or ID |
Returns:
Sets a new value for property
activeBackgroundColor
.
Background color for Icon in active state.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sActiveBackgroundColor | New value for property activeBackgroundColor |
Returns:
Sets a new value for property
activeColor
.
This color is shown when icon is pressed/activated by the user.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sActiveColor | New value for property activeColor |
Returns:
Sets a new value for property
alt
.
This defines the alternative text which is used for outputting the aria-label attribute on the DOM.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sAlt | New value for property alt |
- Since:
- 1.30.0
Returns:
Sets a new value for property
backgroundColor
.
Background color of the Icon in normal state.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sBackgroundColor | New value for property backgroundColor |
Returns:
Sets a new value for property
color
.
The color of the Icon. If color is not defined here, the Icon inherits the color from its DOM parent.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sColor | New value for property color |
Returns:
Sets a new value for property
decorative
.
A decorative icon is included for design reasons. Accessibility tools will ignore decorative icons. Tab stop isn't affected by this property anymore and it's now controlled by the existence of press event handler and the noTabStop property.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bDecorative | New value for property decorative |
- Since:
- 1.16.4
Returns:
Sets a new value for property
height
.
This is the height of the DOM element which contains the Icon. Setting this property doesn't affect the size of the font. If you want to make the font bigger, increase the size property.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns:
Sets a new value for property
hoverBackgroundColor
.
Background color for Icon in hover state. This property has no visual effect when run on mobile device.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sHoverBackgroundColor | New value for property hoverBackgroundColor |
Returns:
Sets a new value for property
hoverColor
.
This color is shown when icon is hovered. This property has no visual effect when run on mobile device.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sHoverColor | New value for property hoverColor |
Returns:
Sets a new value for property
noTabStop
.
Defines whether the tab stop of icon is controlled by the existence of press event handler. When it's set to false, Icon control has tab stop when press event handler is attached. If it's set to true, Icon control never has tab stop no matter whether press event handler exists or not.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Parameters:
{boolean} | bNoTabStop | New value for property noTabStop |
- Since:
- 1.30.1
Returns:
Sets a new value for property
size
.
Since Icon uses font, this property will be applied to the css font-size property on the rendered DOM element.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns:
Sets a new value for property
src
.
This property should be set by the return value of calling sap.ui.core.IconPool.getIconURI with a Icon name parameter and an optional collection parameter which is required when using application extended Icons. A list of standard FontIcon is available here.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns:
Sets a new value for property
useIconTooltip
.
Decides whether a default Icon tooltip should be used if no tooltip is set.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bUseIconTooltip | New value for property useIconTooltip |
- Since:
- 1.30.0
Returns:
Sets a new value for property
width
.
This is the width of the DOM element which contains the Icon. Setting this property doesn't affect the size of the font. If you want to make the font bigger, increase the size property.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns: