Model()
The model for the button UI element, this is what model:ko/ui/button.create
returns
Properties:
Name | Type | Description |
---|---|---|
name |
string | The node name of the element |
element |
Element | A XUL Button, see https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/button |
Extends
- module:ko/ui/element~UiModelElement
Methods
-
<static> addMenuItem(appendElement)
-
Add an item to the container
Parameters:
Name Type Description appendElement
Element | array | object | string Element(s) to be appended. This can be a DOM element, ko/dom element or even just the name of an element. See
module:ko/ui/menupopup~Model.addMenuItem
for more information. If this is a simple object then it will be used as the options paramReturns:
Returns
module:ko/dom~QueryObject
- Type
- Element
-
<static> addMenuItems(item)
-
Add items to the container
Parameters:
Name Type Description item
array Array of items to add, this calls
addMenuItem()
for each item -
<static> isMenuButton()
-
Check if the button has the menu-button type set
Returns:
- Type
- boolean
-
<static> onCommand(callback)
-
Add a callback method that's used when the button is clicked
Example
button.onCommand(function() { console.log("button clicked"); });
Parameters:
Name Type Description callback
function - Deprecated:
-
- use `.on("command", callback)` instead
-
<static> value( [label])
-
Return or set the current value of the element.
Parameters:
Name Type Argument Description label
String <optional>
label to be set
Returns:
the value of the element
- Type
- String