Expand all

abstract OO.ui.mixin.IndicatorElement

Constructor

new OO.ui.mixin.IndicatorElement([config])abstract #

IndicatorElement is often mixed into other classes to generate an indicator. Indicators are small graphics that are generally used in two ways:

  • To draw attention to the status of an item. For example, an indicator might be used to show that an item in a list has errors that need to be resolved.
  • To clarify the function of a control that acts in an exceptional way (a button that opens a menu instead of performing an action directly, for example).

For a list of indicators included in the library, please see the OOUI documentation on MediaWiki.

Note that indicators don't come with any functionality by default. See e.g. SearchInputWidget for a working 'clear' or ComboBoxInputWidget for a working 'down' indicator.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Description
$indicator jQuery optional

The indicator element created by the class. If this configuration is omitted, the indicator element will use a generated <span>.

indicator string optional

Symbolic name of the indicator (e.g. ‘required’ or ‘down’). See the [OOUI documentation on MediaWiki][2] for a list of indicators included in the library. [2]: https://www.mediawiki.org/wiki/OOUI/Widgets/Icons,_Indicators,_and_Labels#Indicators

Source:
IndicatorElement is often mixed into other classes to generate an indicator.

Properties

indicatorstatic #

Symbolic name of the indicator (e.g. ‘required’ or ‘down’). The static property will be overridden if the #indicator configuration is used.

Properties:

Type Description
string | null
Source:
Symbolic name of the indicator (e.g.

indicatorTitlestatic #

A text string used as the indicator title, a function that returns title text, or null for no title. The static property will be overridden if the #indicatorTitle configuration is used.

Properties:

Type Description
string | function | null
Source:

A text string used as the indicator title, a function that returns title text, or null for no title.

Methods

getIndicator() → {string|null} #

Get the symbolic name of the indicator (e.g., ‘required’ or ‘down’).

Source:

Returns:

Symbolic name of indicator, null if not set

Type
string | null
Get the symbolic name of the indicator (e.g., ‘required’ or ‘down’).

setIndicator(indicator) → {OO.ui.Element}chainable #

Set the indicator by its symbolic name. Built-in names currently include ‘clear’, ‘up’, ‘down’ and ‘required’ (declared via indicators.json). Use null to remove the indicator.

Parameters:

Name Type Description
indicator string | null

Symbolic name of indicator, or null for no indicator

Source:

Returns:

The element, for chaining

Type
OO.ui.Element
Set the indicator by its symbolic name.

setIndicatorElement($indicator) #

Set the indicator element.

If an element is already set, it will be cleaned up before setting up the new element.

Parameters:

Name Type Description
$indicator jQuery

Element to use as indicator

Source:
Set the indicator element.