Constructor
new OO.ui.mixin.IconElement([config])abstract
#
IconElement is often mixed into other classes to generate an icon. Icons are graphics, about the size of normal text. They are used to aid the user in locating a control or to convey information in a space-efficient way. See the OOUI documentation on MediaWiki for a list of icons included in the library.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
optional |
Configuration options Properties:
|
- Source:
Properties
iconstatic
#
The symbolic name of the icon (e.g., ‘remove’ or ‘menu’), or a map of symbolic names. A map
is used for i18n purposes and contains a default
icon name and additional names keyed by
language code. The default
name is used when no icon is keyed by the user's language.
Example of an i18n map:
{ default: 'bold-a', en: 'bold-b', de: 'bold-f' }
Note: the static property will be overridden if the #icon configuration is used.
Properties:
Type | Description |
---|---|
Object | string |
- Source:
iconTitlestatic
#
The icon title, displayed when users move the mouse over the icon. The value can be text, a
function that returns title text, or null
for no title.
The static property will be overridden if the #iconTitle configuration is used.
Properties:
Type | Description |
---|---|
string
|
function
|
null
|
- Source:
Methods
getIcon() → {string}
#
Get the symbolic name of the icon.
- Source:
Returns:
Icon name
- Type
- string
setIcon(icon) → {OO.ui.Element}chainable
#
Set icon by symbolic name (e.g., ‘remove’ or ‘menu’). Use null
to remove an icon.
The icon parameter can also be set to a map of icon names. See the #icon config setting
for an example.
Parameters:
Name | Type | Description |
---|---|---|
icon |
Object
|
string
|
null
|
A symbolic icon name, a |
- Source:
Returns:
The element, for chaining
- Type
- OO.ui.Element
setIconElement($icon)
#
Set the icon element. This method is used to retarget an icon mixin so that its functionality applies to the specified icon element instead of the one created by the class. If an icon element is already set, the mixin’s effect on that element is removed. Generated CSS classes and mixin methods will no longer affect the element.
Parameters:
Name | Type | Description |
---|---|---|
$icon |
jQuery | Element to use as icon |
- Source: