simplied button docs to merge docs into examples

This commit is contained in:
Todd Parker 2010-10-13 16:38:29 -04:00
parent 7470e376ad
commit cf0b023480
6 changed files with 121 additions and 57 deletions

View file

@ -15,27 +15,44 @@
</div><!-- /header -->
<div data-role="content">
<p>To visually group a set of buttons together to form a single block of buttons that look contained like a navigation component. To get this effect, wrap a set of buttons in a container with the <code>data-role="controlgroup"</code> attribute and the framework will create a vertical button group. This removes all margins and drop shadows between the buttons and only rounds the top and bottom buttons to get the effect that they are group together. </p>
<pre><code>
&lt;div data-role=&quot;controlgroup&quot;&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Yes&lt;/a&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;No&lt;/a&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Maybe&lt;/a&gt;
&lt;/div&gt;
</pre></code>
<p>By default, grouped buttons are presented as a vertical list:</p>
<div data-role="controlgroup">
<a href="index.html" data-role="button">Yes</a>
<a href="index.html" data-role="button">No</a>
<a href="index.html" data-role="button">Maybe</a>
</div>
<p><strong>Vertical</strong> grouped buttons (default)</p>
<div data-role="controlgroup" data-type="vertical" >
<p>By adding the <code>data-type="horizontal"</code> attribute to the control group container, you can swap this to a horizontal style group that floats the buttons side-by-side and sets the width to only be large enough to fit the content. Be aware that these will wrap to multiple lines if the button number of text length is to wide for the screen.
<p><strong>Horizontal</strong> grouped buttons</p>
<div data-role="controlgroup" data-type="horizontal">
<a href="index.html" data-role="button">Yes</a>
<a href="index.html" data-role="button">No</a>
<a href="index.html" data-role="button">Maybe</a>
</div>
<p><strong>Horizontal</strong> grouped buttons</p>
<p><strong>Horizontal</strong> grouped buttons with icons</p>
<div data-role="controlgroup" data-type="horizontal" >
<a href="index.html" data-role="button" data-icon="arrow-u">Up</a>
<a href="index.html" data-role="button" data-icon="arrow-d">Down</a>
<a href="index.html" data-role="button" data-icon="delete">Remove</a>
<a href="index.html" data-role="button" data-icon="delete">Delete</a>
</div>
<p><strong>Horizontal</strong> grouped buttons, icon only</p>
<div data-role="controlgroup" data-type="horizontal" >
<a href="index.html" data-role="button" data-icon="arrow-u" data-iconpos="notext">Up</a>
<a href="index.html" data-role="button" data-icon="arrow-d" data-iconpos="notext">Down</a>
<a href="index.html" data-role="button" data-icon="delete" data-iconpos="notext">Remove</a>
<a href="index.html" data-role="button" data-icon="delete" data-iconpos="notext">Delete</a>
</div>

View file

@ -15,33 +15,74 @@
</div><!-- /header -->
<div data-role="content">
<p>There a core set of standard icons included in the framework. To minimize the download size of the core icons, jQuery Mobile only includes these icons in white and black colored sprites and automatically adds a semi-transparent black circle behind the icon to make sure it has good contrast on all background colors.</p>
<h2>Adding icons</h2>
<h2>Icon position options</h2>
<p><strong>No icon</strong></p>
<a href="index.html" data-role="button">My button</a>
<p><strong>Left icon</strong> (default) - data-iconpos="left"</p>
<a href="index.html" data-role="button" data-icon="delete">My button</a>
<p><strong>Right icon</strong> - data-iconpos="right"</p>
<a href="index.html" data-role="button" data-icon="delete" data-iconpos="right">My button</a>
<p><strong>Icon only</strong> - data-iconpos="notext"</p>
<a href="index.html" data-role="button" data-icon="delete" data-iconpos="notext">My button</a>
<p>Icons can be added to buttons by adding a <code>data-icon</code> attribute on the anchor to specify the icon to display.</p>
<code>
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot; <strong>data-icon=&quot;delete&quot;</strong>&gt;Delete&lt;/a&gt;
</code>
<p>Creates this button with an icon:</p>
<a href="index.html" data-role="button" data-icon="delete">Delete</a>
<h2>Icon set</h2>
<p>This is a reference for the icon names you can specify in the <code>data-icon</code> attribute.</p>
<p><strong>Left arrow</strong> - data-icon="arrow-u"</p>
<a href="index.html" data-role="button" data-icon="arrow-l">My button</a>
<p><strong>Right arrow</strong> - data-icon="arrow-d"</p>
<a href="index.html" data-role="button" data-icon="arrow-r">My button</a>
<p><strong>Up arrow</strong> - data-icon="arrow-u"</p>
<a href="index.html" data-role="button" data-icon="arrow-u">My button</a>
<p><strong>Down arrow</strong> - data-icon="arrow-d"</p>
<a href="index.html" data-role="button" data-icon="arrow-d">My button</a>
<p><strong>Delete</strong> - data-icon="delete"</p>
<a href="index.html" data-role="button" data-icon="delete">My button</a>
<p><strong>Plus</strong> - data-icon="plus"</p>
<a href="index.html" data-role="button" data-icon="plus">My button</a>
<p><strong>Minus</strong> - data-icon="minus"</p>
<a href="index.html" data-role="button" data-icon="minus">My button</a>
<h2>Icon glyphs</h2>
<p><strong>Left arrow</strong> - data-icon="arrow-u"</p>
<a href="index.html" data-role="button" data-icon="arrow-l">My button</a>
<p><strong>Right arrow</strong> - data-icon="arrow-d"</p>
<a href="index.html" data-role="button" data-icon="arrow-r">My button</a>
<p><strong>Up arrow</strong> - data-icon="arrow-u"</p>
<a href="index.html" data-role="button" data-icon="arrow-u">My button</a>
<p><strong>Down arrow</strong> - data-icon="arrow-d"</p>
<a href="index.html" data-role="button" data-icon="arrow-d">My button</a>
<p><strong>Delete</strong> - data-icon="delete"</p>
<a href="index.html" data-role="button" data-icon="delete">My button</a>
<p><strong>Plus</strong> - data-icon="plus"</p>
<a href="index.html" data-role="button" data-icon="plus">My button</a>
<p><strong>Minus</strong> - data-icon="minus"</p>
<a href="index.html" data-role="button" data-icon="minus">My button</a>
<code>
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot; <strong>data-icon=&quot;delete&quot;</strong>&gt;Delete&lt;/a&gt;
</code>
<p>Creates this button with an icon:</p>
<a href="index.html" data-role="button" data-icon="delete">Delete</a>
<h2>Icon positioning</h2>
<p>By default, icons in buttons are added to the left of the text, but the <code>data-iconpos</code> attribute specifies the icon position: <code>left</code> or <code>right</code> of the text.</p>
<code>
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot; data-icon=&quot;delete&quot;<strong> data-iconpos=&quot;right&quot;</strong>&gt;Delete&lt;/a&gt;
</code>
<p>Creates this button with right-aligned icon:</p>
<a href="index.html" data-role="button" data-icon="delete" data-iconpos="right">Delete</a>
<p>To create an icon-only button that has an icon but no text, set the <code>data-iconpos</code> attribute to <code>notext</code> and the button plugin will hide the text and add it as a <code>title</code> attribute on the link to provide context for screen readers and devices that support tooltips. In this example, we're adding a plus (+) icon and positioning it to the right of the text with our <code>data-</code> attributes on the link.</p>
<code>
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot; data-icon=&quot;delete&quot;<strong> data-iconpos=&quot;notext&quot;</strong>&gt;Delete&lt;/a&gt;
</code>
<p>Creates this icon-only button:</p>
<a href="index.html" data-role="button" data-icon="delete" data-iconpos="notext">Delete</a>
<p>To use custom icons, specify a <code>data-icon</code> value that has a unique name like <code>myapp-email</code> and the button plugin will generate a class by prefixing <code>ui-icon-</code> to the <code>data-icon</code> value and apply it to the button. You can then write a CSS rule that targets the <code>ui-icon-myapp-email</code> class to specify the icon background source. To maintain visual consistency, create a white icon 18x18 pixels saved as a PNG-8 with alpha transparency.</p>
</div><!-- /content -->
</div><!-- /page -->

View file

@ -16,25 +16,23 @@
<div data-role="content">
<p>If you have multiple buttons that should sit side-by-side on the same line instead of stacked like the default buttons, wrap the buttons in a container that has a <code>data-inline="true"</code> attribute. This will style the buttons to be the width of their content and float the buttons so they sit on the same line. </p>
<pre><code>
&lt;div data-inline=&quot;true&quot;&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Cancel&lt;/a&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Save&lt;/a&gt;
&lt;/div&gt;
</pre></code>
<p><strong>Inline</strong> buttons</p>
<a href="index.html" data-role="button" data-inline="true">Cancel</a>
<a href="index.html" data-role="button" data-theme="b" data-inline="true">Save</a>
<p><strong>Inline toolbar</strong> buttons</p>
<div data-role="footer" data-position="inline">
<select name="select-choice-1" id="select-choice-1" data-theme="a">
<option value="Choice 1">Choice 1</option>
<option value="Choice 2">Choice 2</option>
<option value="Choice 3">Choice 3</option>
</select>
<a href="index.html" data-role="button" data-icon="delete">Remove</a>
<a href="index.html" data-role="button" data-icon="plus">Add</a>
<a href="index.html" data-role="button" data-icon="arrow-u">Up</a>
<a href="index.html" data-role="button" data-icon="arrow-d">Down</a>
</div>
<p>If you want buttons to sit side-by-side but stretch to fill the width of the screen, you can use the <a href="content/content-grids.html">content column grids</a> to put normal full-width buttons into 2- or 3-columns.</p>
</div><!-- /content -->

View file

@ -15,10 +15,22 @@
</div><!-- /header -->
<div data-role="content">
<h2>Styling links as buttons</h2>
<p>In the main content block of a page, you can style any link as a button by adding the <code>data-role="button"</code> to the link. The framework will add the necessary classes to style the link as a button. </p>
<code>
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Link button&lt;/a&gt;
</code>
<p><strong>Link</strong> based button example:</p>
<a href="index.html" data-role="button">Link button</a>
<p><strong>Link</strong> based button</p>
<a href="index.html" data-role="button">Link element</a>
<h2>Form buttons</h2>
<p>A <code>button</code> element or an <code>input</code> with a <code>type</code> of <code>submit</code>, <code>reset</code>, <code>button</code>, or <code>image</code> will all be automatically transformed into a custom styled button, no need to add the <code>data-role="button"</code> attribute. </p>
<p>Because it's not possible to consistently form buttons consistently across platforms, the framework actually generates a new link-based button for each form button button and hides the original. When a click event fires on a link button, it triggers a click on the original form button.</p>
<p><strong>Button</strong> based button</p>
<button>Button element</button>

View file

@ -67,10 +67,12 @@
<p>If you have multiple buttons that should sit side-by-side on the same line instead of stacked like the default buttons, wrap the buttons in a container that has a <code>data-inline="true"</code> attribute. This will style the buttons to be the width of their content and float the buttons so they sit on the same line. </p>
&lt;div data-inline=&quot;true&quot;&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Cancel&lt;/a&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Save&lt;/a&gt;
&lt;/div&gt;
<pre><code>
&lt;div data-inline=&quot;true&quot;&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Cancel&lt;/a&gt;
&lt;a href=&quot;index.html&quot; data-role=&quot;button&quot;&gt;Save&lt;/a&gt;
&lt;/div&gt;
</pre></code>
<h2>Grouping</h2>

View file

@ -16,14 +16,6 @@
<div data-role="content">
<p>Buttons are one of the core widgets in jQuery Mobile and are used within a wide range of other plugins.</p>
<ul data-role="listview" data-inset="true">
<li data-role="list-divider">Documentation</li>
<li><a href="docs-buttons.html">Button basics</a></li>
<li><a href="api-buttons.html">API documentation</a></li>
<li><a href="buttons-themes.html">Theming buttons</a></li>
</ul>
<ul data-role="listview" data-inset="true">
<li data-role="list-divider">Button examples</li>
@ -31,6 +23,8 @@
<li><a href="buttons-icons.html">Button icons</a></li>
<li><a href="buttons-inline.html">Inline buttons</a></li>
<li><a href="buttons-grouped.html">Grouped buttons</a></li>
<li><a href="buttons-themes.html">Theming buttons</a></li>
<li><a href="api-buttons.html">API documentation</a></li>
</ul>
</div><!-- /ui-body wrapper -->
</div><!-- /page -->