Constructor
JavaScript:
-
new Coral.Icon()
ordocument.createElement('coral-icon')
HTML Tag:
-
<coral-icon>
Extends
Static Properties
-
Coral.Icon.size {String}
-
Properties:
Name Type Value Description EXTRA_EXTRA_SMALL String XXS Extra extra small size icon, typically 9px size. EXTRA_SMALL String XS Extra small size icon, typically 12px size. SMALL String S Small size icon, typically 18px size. This is the default size. MEDIUM String M Medium size icon, typically 24px size. LARGE String L Large icon, typically 36px size. EXTRA_LARGE String XL Extra large icon, typically 48px size. EXTRA_EXTRA_LARGE String XXL Extra extra large icon, typically 72px size.
Instance Properties
-
instance.alt {String}
Reflected -
- HTML Attribute:
- alt
-
instance.hidden {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- hidden
-
instance.icon {String}
Reflected -
- Default Value:
- ""
- HTML Attribute:
- icon
-
instance.size {Coral.Icon.size}
Reflected -
- Default Value:
- Coral.Icon.size.SMALL
- HTML Attribute:
- size
-
instance.tracking {Coral.Component.tracking}
-
- Inherited From:
- Default Value:
- Coral.Component.tracking.ON
- HTML Attribute:
- tracking
-
instance.trackingElement {String}
-
- Inherited From:
- Default Value:
- ""
- HTML Attribute:
- trackingelement
-
instance.trackingFeature {String}
-
- Inherited From:
- Default Value:
- ""
- HTML Attribute:
- trackingfeature
When no alt
attribute is provided, the icon will fallback to using either the title
attribute or icon name as alternative text for accessibility. However, by explicitly setting the alt
attribute to an empty string in markup or by using the setAttribute
method, one can override the default behavior to avoid redundancy or to indicate that the icon is purely decorative in elements like labelled icon buttons.
Methods
-
instance.get
-
- Parameters:
-
Name Type Description property String The name of the property to fetch the value of. - Returns:
-
Property value. {*}
- Inherited From:
-
instance.hide
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.off
-
- Parameters:
-
Name Type Optional Description eventName String No
The event name to stop listening for. selector String Yes
The selector that was used for event delegation. func function No
The function that was passed to on()
.useCapture Boolean Yes
Only remove listeners with useCapture
set to the value passed in. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.on
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to listen for. selector String Yes
The selector to use for event delegation. func function No
The function that will be called when the event is triggered. useCapture Boolean Yes
Whether or not to listen during the capturing or bubbling phase. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.remove
-
- Inherited From:
-
instance.set
-
- Parameters:
-
Name Type Description property String The name of the property to set. value * The value to set the property to. silent Boolean If true, events should not be triggered as a result of this set. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.show
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.trigger
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to trigger. props Object Yes
Additional properties to make available to handlers as event.detail
.bubbles Boolean Yes
Set to false
to prevent the event from bubbling.cancelable Boolean Yes
Set to false
to prevent the event from being cancelable. - Returns:
-
CustomEvent object {CustomEvent}
- Inherited From:
Events
-
coral-component:attached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserver
instead.
- since 1.14.0, use
-
coral-component:detached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserver
instead.
- since 1.14.0, use
-
coral-component:ready
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.9.0, use
Coral.commons.ready()
instead.
- since 1.9.0, use