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:
|
- Source:
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:
null
for no title.
Methods
getTitle() → {string|null
}
#
null
}
#
setTitle(title) → {OO.ui.Element}chainable
#
Set title.
Parameters:
Name | Type | Description |
---|---|---|
title |
string
|
function
|
null
|
Title text, a function that returns text, or |
- Source:
Returns:
The element, for chaining
- Type
- OO.ui.Element
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:
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