Constructor
new Button(configopt)
- Source:
Create a button.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object |
<optional> |
Properties
|
Members
buttonElement :Element
- Source:
Button element (an 'a'
element by default). It can be the same as the
main element or its descendant.
Type:
- Element
element :Element
- Source:
Main element. It can be the same as the link element or a wrapper around it.
Type:
- Element
iconElement :Element|undefined
- Source:
Button icon element, a descendant of the link element.
Type:
- Element | undefined
labelElement :Element
- Source:
Button label element. It can be the same as the link element or its descendant.
Type:
- Element
Methods
hide() → {Button}
- Source:
Hide the button.
Returns:
This button.
- Type
- Button
isDisabled() → {boolean}
- Source:
Check whether the button is disabled.
Returns:
- Type
- boolean
isPending() → {boolean}
- Source:
Check whether the button is pending.
Returns:
- Type
- boolean
(protected) maybeExecuteAction(action, e)
- Source:
Execute a pre-defined action if the button is conditions are met.
Parameters:
Name | Type | Description |
---|---|---|
action |
function | |
e |
Event |
setAction(actionnullable) → {Button}
- Source:
Set the action of the button. It will be executed on click or Enter press.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
action |
function |
<nullable> |
Returns:
This button.
- Type
- Button
setDisabled(disabled) → {Button}
- Source:
Set the button disabled or not.
Parameters:
Name | Type | Description |
---|---|---|
disabled |
boolean |
Returns:
This button.
- Type
- Button
setHref(href) → {Button}
- Source:
Set the href
attribute of the button.
Parameters:
Name | Type | Description |
---|---|---|
href |
string |
Returns:
This button.
- Type
- Button
setIconProgressive()
- Source:
Set the class to an OOUI icon to make it look like icons with the "progressive" flag do. Somehow OOUI doesn't set it at the building stage.
setLabel(label) → {Button}
- Source:
Set the label of the button.
Parameters:
Name | Type | Description |
---|---|---|
label |
string |
Returns:
This button.
- Type
- Button
setPending(pending) → {Button}
- Source:
Set the button pending or not.
Parameters:
Name | Type | Description |
---|---|---|
pending |
boolean |
Returns:
This button.
- Type
- Button
setTooltip(tooltip) → {Button}
- Source:
Set the tooltip of the button.
Parameters:
Name | Type | Description |
---|---|---|
tooltip |
string |
Returns:
This button.
- Type
- Button
show() → {Button}
- Source:
Show the button.
Returns:
This button.
- Type
- Button
toggle(show) → {Button}
- Source:
Show or hide the button, depending on the parameter.
Parameters:
Name | Type | Description |
---|---|---|
show |
boolean | Whether to show the button. |
Returns:
This button.
- Type
- Button