Expand all

abstract OO.ui.mixin.TitledElement

Constructor

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

TitledElement is mixed into other classes to provide a title attribute. Titles are rendered by the browser and are made visible when the user moves the mouse over the element. Titles are not visible on touch devices.

Example

// TitledElement provides a `title` attribute to the
    // ButtonWidget class.
    const button = new OO.ui.ButtonWidget( {
        label: 'Button with Title',
        title: 'I am a button'
    } );
    $( document.body ).append( button.$element );

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Description
$titled jQuery optional

The element to which the title attribute is applied. If this config is omitted, the title functionality is applied to $element, the element created by the class.

title string | function optional

The title text or a function that returns text. If this config is omitted, the value of the static title property is used. If config for an invisible label (OO.ui.mixin.LabelElement) is present, and a title is omitted, the label will be used as a fallback for the title.

Source:
TitledElement is mixed into other classes to provide a title attribute.

Properties

titlestatic #

The title text, a function that returns text, or null for no title. The value of the static property is overridden if the #title config option is used.

If the element has a default title (e.g. <input type=file>), null will allow that title to be shown. Use empty string to suppress it.

Properties:

Type Description
string | function | null
Source:
The title text, a function that returns text, or null for no title.

Methods

getTitle() → {string|null} #

Get title.

Source:

Returns:

Title string

Type
string | null
Get title.

setTitle(title) → {OO.ui.Element}chainable #

Set title.

Parameters:

Name Type Description
title string | function | null

Title text, a function that returns text, or null for no title

Source:

Returns:

The element, for chaining

Type
OO.ui.Element
Set title.

setTitledElement($titled) #

Set the titled element.

This method is used to retarget a TitledElement mixin so that its functionality applies to the specified element. If an element is already set, the mixin’s effect on that element is removed before the new element is set up.

Parameters:

Name Type Description
$titled jQuery

Element that should use the 'titled' functionality

Source:
Set the titled element.

updateTitle() → {OO.ui.Element}protectedchainable #

Update the title attribute, in case of changes to title or accessKey.

Source:

Returns:

The element, for chaining

Type
OO.ui.Element
Update the title attribute, in case of changes to title or accessKey.