|
5 | 5 | <longdesc>
|
6 | 6 | <p>Button enhances standard form elements like buttons, inputs and anchors to themeable buttons with appropriate hover and active styles.</p>
|
7 | 7 |
|
8 |
| - <p>In addition to basic push buttons, radio buttons and checkboxes (inputs of type radio and checkbox) can be converted to buttons. Their associated label is styled to appear as the button, while the underlying input is updated on click. For the association to work properly, give the input an <code>id</code> attribute, and refer to that in the label's <code>for</code> attribute. Don't nest the input inside the label, as that <a href="http://www.paciellogroup.com/blog/2011/07/html5-accessibility-chops-form-control-labeling/">causes accessibility problems</a>.</p> |
9 |
| - |
10 |
| - <p>In order to group radio buttons, you can use the <a href="/buttonset/">Buttonset</a> widget, which provides visual groupings of buttons.</p> |
11 |
| - |
12 | 8 | <p>When using an input of type button, submit or reset, support is limited to plain text labels with no icons.</p>
|
13 | 9 |
|
| 10 | + <p class="warning">Note: The button widget was rewritten in 1.12. Some options changed, you can find documentation for the old options in the <a href="/1.11/button/">1.11 button docs</a>. This widget used to bundle support for inputs of type radio and checkbox, this is now deprecated, use the <a href="/checkboxradio/">checkboxradio widget</a> instead. It also used to bundle the buttonset widget, this is also deprecated, use the <a href="/controlgroup/">controlgroup widget</a> instead.</p> |
| 11 | + |
14 | 12 | <xi:include href="../includes/widget-theming.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
15 | 13 |
|
16 | 14 | <ul>
|
17 | 15 | <li>
|
18 |
| - <code>ui-button</code>: The DOM element that represents the button. This element will additionally have one of the following classes depending on the <a href="#option-text">text</a> and <a href="#option-icons">icons</a> option: <code>ui-button-text-only</code>, <code>ui-button-icon-only</code>, <code>ui-button-icons-only</code>, <code>ui-button-text-icons</code>. |
| 16 | + <code>ui-button</code>: The DOM element that represents the button. This element will additionally have the <code>ui-button-icon-only</code> class, depending on the <a href="#option-showLabel">showLabel</a> and <a href="#option-icon">icon</a> options. |
19 | 17 | <ul>
|
20 | 18 | <li>
|
21 |
| - <code>ui-button-icon-primary</code>: The element used to display the button's primary icon. This will only be present if a primary icon is provided in the <a href="#option-icons">icons</a> option. |
| 19 | + <code>ui-button-icon</code>: The element used to display the button icon. This will only be present if an icon is provided in the <a href="#option-icon">icon</a> option. |
22 | 20 | </li>
|
23 | 21 | <li>
|
24 |
| - <code>ui-button-text</code>: The container around the textual content of the button. |
25 |
| - </li> |
26 |
| - <li> |
27 |
| - <code>ui-button-icon-secondary</code>: The element used to display the button's secondary icon. This will only be present if a secondary icon is provided in the <a href="#option-icons">icons</a> option. |
| 22 | + <code>ui-button-icon-space</code>: A separator element between icon and text content of the button. This will only be present if an icon is provided in the <a href="#option-icon">icon</a> option and the <a href="#option-iconPosition">iconPosition</a> option is set to <code>"beginning"</code> or <code>"end"</code>. |
28 | 23 | </li>
|
29 | 24 | </ul>
|
30 | 25 | </li>
|
31 | 26 | </ul>
|
32 | 27 |
|
33 | 28 | <h3>Dependencies</h3>
|
34 | 29 | <ul>
|
35 |
| - <li><a href="/category/ui-core/">UI Core</a></li> |
| 30 | + <li><a href="/jQuery.ui.keyCode/">jQuery.ui.keyCode</a></li> |
36 | 31 | <li><a href="/jQuery.widget/">Widget Factory</a></li>
|
37 | 32 | </ul>
|
38 | 33 | </longdesc>
|
39 | 34 | <note id="functional-css"/>
|
40 |
| - <added>1.8</added> |
| 35 | + <added>1.8, rewritten: 1.12</added> |
41 | 36 | <options>
|
42 | 37 | <option name="classes" type="Object">
|
43 | 38 | <default>{
|
|
47 | 42 | <xi:include href="../includes/classes-option-example.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
48 | 43 | </option>
|
49 | 44 | <xi:include href="../includes/widget-option-disabled.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
50 |
| - <option name="icons" default="{ primary: null, secondary: null }" example-value='{ primary: "ui-icon-gear", secondary: "ui-icon-triangle-1-s" }'> |
| 45 | + <option name="icon" default="null" example-value='{ icon: "ui-icon-gear" }'> |
51 | 46 | <desc>
|
52 |
| - <p>Icons to display, with or without text (see <a href="#option-text"><code>text</code></a> option). By default, the primary icon is displayed on the left of the label text and the secondary is displayed on the right. The positioning can be controlled via CSS.</p> |
53 |
| - |
54 |
| - <p>The value for the <code>primary</code> and <code>secondary</code> properties must match <a href="/theming/icons/">an icon class name</a>, e.g., <code>"ui-icon-gear"</code>. For using only one icon: <code>icons: { primary: "ui-icon-locked" }</code>. For using two icons: <code>icons: { primary: "ui-icon-gear", secondary: "ui-icon-triangle-1-s" }</code>.</p> |
| 47 | + <p>Icon to display, with or without text (see <a href="#option-showLabel"><code>showLabel</code></a> option). By default, the icon is displayed on the left of the label text. The positioning can be controlled using the <a href="#option-iconPosition"><code>iconPosition</code></a> option.</p> |
| 48 | + <p>The value for this option must match <a href="/theming/icons/">an icon class name</a>, e.g., <code>"ui-icon-gear"</code>.</p> |
55 | 49 | <p>When using an input of type button, submit or reset, icons are not supported.</p>
|
56 | 50 | </desc>
|
57 |
| - <type name="Object" /> |
| 51 | + <type name="String" /> |
| 52 | + </option> |
| 53 | + <option name="iconPosition" default='"beginning"' example-value='{ iconPositon: "end" }'> |
| 54 | + <desc> |
| 55 | + <p>Where to display the <a href="#option-icon"><code>icon</code></a>: Valid values are "beginning", "end", "top" and "bottom". In a left-to-right (LTR) display, "beginning" refers to the left, in a right-to-left (RTL, e.g. in Hebrew or Arabic), it refers to the right.</p> |
| 56 | + </desc> |
| 57 | + <type name="String" /> |
58 | 58 | </option>
|
59 | 59 | <option name="label" default="null" example-value='"custom label"'>
|
60 | 60 | <desc>
|
|
63 | 63 | </desc>
|
64 | 64 | <type name="String" />
|
65 | 65 | </option>
|
66 |
| - <option name="text" default="true" example-value="false"> |
67 |
| - <desc>Whether to show the label. When set to <code>false</code> no text will be displayed, but the <a href="#option-icons"><code>icons</code></a> option must be enabled, otherwise the <code>text</code> option will be ignored.</desc> |
| 66 | + <option name="showLabel" default="true" example-value="false"> |
| 67 | + <desc>Whether to show the label. When set to <code>false</code> no text will be displayed, but the <a href="#option-icon"><code>icon</code></a> option must be used, otherwise the <code>showLabel</code> option will be ignored.</desc> |
68 | 68 | <type name="Boolean" />
|
69 | 69 | </option>
|
70 | 70 | </options>
|
|
76 | 76 | <xi:include href="../includes/widget-method-disable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
77 | 77 | <xi:include href="../includes/widget-method-enable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
78 | 78 | <method name="refresh">
|
79 |
| - <desc>Refreshes the visual state of the button. Useful for updating button state after the native element's checked or disabled state is changed programmatically.</desc> |
| 79 | + <desc>Refreshes the visual state of the button. Useful for updating button state after the native element's disabled state is changed programmatically.</desc> |
80 | 80 | </method>
|
81 | 81 | <xi:include href="../includes/widget-method-instance.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
82 | 82 | <xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
|
0 commit comments