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 OOjs UI documentation on MediaWiki for a list of icons included in the library.
- Source:
Methods
getIcon() → {string}
Get the symbolic name of the icon.
- Source:
Returns:
Icon name
- Type
- string
getIconTitle() → {string}
Get the icon title. The title text is displayed when a user moves the mouse over the icon.
- Source:
Returns:
Icon title text
- Type
- string
setIcon(icon)
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 map of icon names keyed
by language code, or |
- Source:
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:
setIconTitle(iconTitle)
Set the icon title. Use null
to remove the title.
Parameters:
Name | Type | Description |
---|---|---|
iconTitle |
string | function | null | A text string used as the icon title,
a function that returns title text, or |
- Source: