0% found this document useful (0 votes)
53 views1 page

Button

The document summarizes the YUI Library Button and ButtonGroup widgets. It provides examples of creating Button and ButtonGroup instances from markup or code. It lists the key properties, methods, events, and configuration options for Buttons and ButtonGroups. Buttons can be configured with options like type, label, name, value, and menu. ButtonGroups allow managing a group of buttons with options like name, value, and checkedButton.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

Button

The document summarizes the YUI Library Button and ButtonGroup widgets. It provides examples of creating Button and ButtonGroup instances from markup or code. It lists the key properties, methods, events, and configuration options for Buttons and ButtonGroups. Buttons can be configured with options like type, label, name, value, and menu. ButtonGroups allow managing a group of buttons with options like name, value, and checkedButton.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

YUI Library: Button 2009-9-8 v2.

8
Simple Use Cases: YAHOO.widget.Button Key Interesting Moments in Button YAHOO.widget.Button:
See online docs for a complete list of Button's Events. Properties
Create a Button instance using existing markup:
focus blur CSS_CLASS_NAME
Markup: click option NODE_NAME
<input type=”button” id=”mybutton” name=”mybutton” All Button events are Custom Events (see Event Utility docs); subscribe to these events using “addListener”:
value=”Press Me!”> (e.g. oButton.addListener(“click”, fn); ). YAHOO.widget.Button:
Script: Methods
var oButton = new YAHOO.widget.Button("mybutton"); Key Interesting Moments in ButtonGroup
See online docs for a complete list of ButtonGroup's Events. blur()
Create a Button instance using script alone: Event: Event Fields: destroy()
var oButton = checkedButtonChange type (s), prevValue (s), newValue (s) focus()
new YAHOO.widget.Button({ label:"Press Me!”}); All ButtonGroup events are Custom Events (see Event Utility docs); subscribe to these events using getForm()
addListener (e.g. oButtonGroup.addListener(“checkedButtonChange”, fn); ). getMenu()
hasFocus()
Constructor: YAHOO.widget.Button Key Button Configuration Options isActive()
See online docs for complete list of Buttion configuration options. set([attr name], [attr value])
YAHOO.widget.Button(str|HTMLElement|obj element[, obj get([attr name])
configuration object]); Option (type) Default Description
type (s) “push” String specifying the button's type. (Possible
Arguments: values are: "push," "link," "submit," "reset," YAHOO.widget. ButtonGroup:
(1) element: HTML ID or HTMLElement of existing markup to "checkbox," "radio," "menu," and "split.") Properties
use when building Button. If neither, this is treated as the label (s) null The button's text label or innerHTML.
CSS_CLASS_NAME
Configuration object. name (s) null The name for the button. NODE_NAME
(2) configuration object: JS object defining configuration value (o) null The value for the button.
properties for the Button instance. See Configuration section checked (b) false Boolean indicating if the button is checked.
(For buttons of type "radio" and "checkbox.")
YAHOO.widget. ButtonGroup:
for full list. Methods
disabled (b) false Boolean indicating if the button should be
disabled. (Disabled buttons are dimmed and addButton(button)
Simple Use Cases: YAHOO.widget.ButtonGroup will not respond to user input or fire events.) addButtons([]buttons)
href (s) null The href for the button. (For to buttons of type check(index)
Create a ButtonGroup instance using existing markup: "link.") destroy()
Markup: menu (o) null Element id, array of YAHOO.widget.MenuItem focus(index)
<div id="mybuttongroup"> configuration attributes, or getButton(index)
<input type="radio" name="myfield" value="One"> YAHOO.widget.Menu instance. (For buttons of getButtons()
<input type="radio" name="myfield" value="Two"> type "menu" and “split.”) getCount()
<input type="radio" name="myfield" value="Three"> menumaxheight (n) 0 The max height height of a Menu before it removeButton(index)
</div> scrolls. set([attr name], [attr value])
Script: menualignment (a) [“tl”,”bl”] How the Menu is aligned to the Button. get([attr name])
var oButtonGroup = new Button options can be set in the constructor's second argument (eg, {disabled: true}) or at runtime via
set (eg, oButton.set("disabled", true);).
YAHOO.widget.ButtonGroup("mybuttongroup");
Dependencies
Key ButtonGroup Configuration Options
Constructor: YAHOO.widget.ButtonGroup See online docs for complete list of ButtonGroup configuration options. Button requires the
YAHOO.widget.ButtonGroup(str|HTMLElement|obj element[, Option (type) Default Description YAHOO Object,
obj configuration object]); name (s) null The name for the button group (will be applied Event, Dom, and
to each button in the button group). Element. Optional:
Arguments: disabled (b) false Boolean indicating if the button group should be Container Core and
(1) element: HTML ID or HTMLElement of existing markup to disabled. (Disabling the button group will Menu.
use when building ButtonGroup. If neither, this is treated as disable each button in the button group.)
the Configuration object. value (o) null Object specifying the value for the button.
(2) configuration object: JS object defining configuration checkedButton (o) null The checked button in the button group.
properties for the ButtonGroup instance. See Configuration ButtonGroup options can be set in the constructor's second argument (eg, {disabled: true}) or at runtime
via set (eg, oButtonGroup.set("disabled", true);).
section for full list.

You might also like