5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>jQuery Mobile Docs - Data Attribute Reference</title>
7 <link rel="stylesheet" href="../../css/themes/default/" />
8 <link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
9 <script src="../../js/jquery.js"></script>
10 <script src="../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
11 <script src="../_assets/js/jqm-docs.js"></script>
12 <script src="../../js/"></script>
16 <div data-role="page" class="type-interior">
18 <div data-role="header" data-theme="f">
19 <h1>Data Attributes</h1>
20 <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
21 </div><!-- /header -->
23 <div data-role="content" data-theme="c">
25 <div class="content-primary">
26 <h2>Data- attribute reference</h2>
27 <p>The jQuery Mobile framework uses HTML5 <code>data-</code> attributes to allow for markup-based initialization and configuration of widgets. These attributes are completely optional; calling plugins manually and passing options directly is also supported. To avoid naming conflicts with other plugins or frameworks that also use <code>data-</code> attributes, set a custom namespace by modifying the <a href="globalconfig.html"><code>ns</code> global option</a>.<p>
30 table { width:100%; border-bottom:1px solid #ccc; }
31 th { text-align:left; width: 170px; }
32 th, td { vertical-align:top; border-top:1px solid #ccc; padding: 6px 10px 4px 0; }
35 <h2><a href="../buttons/buttons-types.html">Button</a></h2>
36 <p>Links with <code>data-role="button"</code>. Input-based buttons and button elements are auto-enhanced, no <code>data-role</code> required</p>
40 <td><strong>true</strong> | false</td>
44 <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
48 <td><strong>left</strong> | right | top | bottom | notext</td>
51 <th>data-iconshadow</th>
52 <td><strong>true</strong> | false</td>
56 <td>true | <strong>false</strong></td>
60 <td><strong>true</strong> | false</td>
64 <td>swatch letter (a-z)</td>
67 <p>Multiple buttons can be wrapped in a container with a <code>data-role="controlgroup"</code> attribute for a vertically grouped set. Add the <code>data-type="horizontal"</code> attribute for the buttons to sit side-by-side.</p>
70 <h2><a href="../forms/checkboxes/">Checkbox</a></h2>
71 <p>Pairs of labels and inputs with <code>type="checkbox"</code> are auto-enhanced, no <code>data-role</code> required</p>
75 <td>none (prevents auto-enhancement to use native control)</td>
79 <td>swatch letter (a-z) - Added to the form element</td>
83 <h2><a href="../content/content-collapsible.html">Collapsible</a></h2>
84 <p>A heading and content wrapped in a container with the <code>data-role="collapsible"</code></p>
87 <th>data-collapsed</th>
88 <td><strong>true</strong> | false</td>
91 <th>data-content-theme</th>
92 <td>swatch letter (a-z)</td>
96 <td>swatch letter (a-z)</td>
100 <h2><a href="../content/content-collapsible-set.html">Collapsible set</a></h2>
101 <p>A number of collapsibles wrapped in a container with the <code>data-role="collapsible-set"</code></p>
104 <th>data-content-theme</th>
105 <td>swatch letter (a-z) - Sets all collapsibles in set</td>
109 <td>swatch letter (a-z) - Sets all collapsibles in set</td>
113 <h2><a href="../pages/page-dialogs.html">Dialog</a></h2>
114 <p>Container with <code>data-role="page"</code> or <code>"dialog"</code> linked to with <code>data-rel="dialog"</code> on the anchor.</p>
117 <th>data-close-btn-text</th>
118 <td>string (text for the close button, dialog only)</td>
121 <th>data-dom-cache</th>
122 <td>true | <strong>false</strong></td>
126 <td>string (unique id for the page)</td>
129 <th>data-fullscreen</th>
130 <td>true | false (used in conjunction with fixed toolbars)</td>
133 <th>data-overlay-theme</th>
134 <td>swatch letter (a-z) - overlay theme when the page is opened in a dialog</td>
138 <td>swatch letter (a-z)</td>
142 <td>string (title used when page is shown)</td>
146 <h2><a href="../pages/page-anatomy.html">Content</a></h2>
147 <p>Container with <code>data-role="content"</code></p>
151 <td>swatch letter (a-z)</td>
156 <h2><a href="../forms/docs-forms.html">Field container</a></h2>
157 <p>Container with <code>data-role="fieldcontain"</code> wrapped around label/form element pair</p>
159 <h2><a href="../forms/switch/">Flip toggle switch</a></h2>
160 <p>Select with <code>data-role="slider"</code>, two options only</p>
164 <td>none (prevents auto-enhancement to use native control)</td>
168 <td>swatch letter (a-z) - Added to the form element</td>
171 <th>data-track-theme</th>
172 <td>swatch letter (a-z) - Added to the form element</td>
176 <h2><a href="../toolbars/docs-footers.html">Footer</a></h2>
177 <p>Container with <code>data-role="footer"</code></p>
181 <td>string (unique id, useful in persistent footers)</td>
184 <th>data-position</th>
189 <td>swatch letter (a-z)</td>
193 <h2><a href="../toolbars/docs-headers.html">Header</a></h2>
194 <p>Container with <code>data-role="header"</code></p>
197 <th>data-add-back-btn</th>
198 <td>true | <strong>false</strong> (auto add back button, header only)</td>
201 <th>data-back-btn-text</th>
205 <th>data-back-btn-theme</th>
206 <td>swatch letter (a-z)</td>
209 <th>data-position</th>
214 <td>swatch letter (a-z)</td>
218 <td>string (title used when page is shown)</td>
222 <h2><a href="../pages/page-links.html">Link</a></h2>
223 <p>Links, including those with a <code>data-role="button"</code>, and form submit buttons share these attributes</p>
227 <td><strong>true</strong> | false</td>
230 <th>data-direction</th>
231 <td>reverse (reverse page transition animation)</td>
234 <th>data-dom-cache</th>
235 <td>true | <strong>false</strong></td>
238 <th>data-prefetch</th>
239 <td>true | <strong>false</strong></td>
243 <td>back (to move one step back in history)<br />
244 dialog (to open link styled as dialog, not tracked in history)<br />
245 external (for linking to another domain)</td>
248 <th>data-transition</th>
249 <td><strong>slide</strong> | slideup | slidedown | pop | fade | flip</td>
253 <h2><a href="../lists/docs-lists.html">Listview</a></h2>
254 <p>OL or UL with <code>data-role="listview"</code></p>
257 <th>data-count-theme</th>
258 <td>swatch letter (a-z)</td>
261 <th>data-dividertheme</th>
262 <td>swatch letter (a-z)</td>
266 <td>true | <strong>false</strong></td>
269 <th>data-filter-placeholder</th>
273 <th>data-filter-theme</th>
274 <td>swatch letter (a-z)</td>
278 <td>true | <strong>false</strong></td>
281 <th>data-split-icon</th>
282 <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
286 <td>swatch letter (a-z)</td>
290 <h2><a href="../lists/docs-lists.html">Listview item</a></h2>
291 <p>LI within a listview</p>
295 <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
299 <td>list-divider</td>
303 <td>swatch letter (a-z) - can also be set on individual LIs</td>
307 <h2><a href="../pages/page-anatomy.html">Page</a></h2>
308 <p>Container with <code>data-role="page"</code></p>
311 <th>data-close-btn-text</th>
312 <td>string (text for the close button, dialog only)</td>
315 <th>data-dom-cache</th>
316 <td>true | <strong>false</strong></td>
320 <td>string (unique id for the page)</td>
323 <th>data-fullscreen</th>
324 <td>true | false (used in conjunction with fixed toolbars)</td>
327 <th>data-overlay-theme</th>
328 <td>swatch letter (a-z) - overlay theme when the page is opened in a dialog</td>
332 <td>swatch letter (a-z)</td>
336 <td>string (title used when page is shown)</td>
340 <h2><a href="../forms/radiobuttons/">Radio button</a></h2>
341 <p>Pairs of labels and inputs with <code>type="radio"</code> are auto-enhanced, no <code>data-role</code> required</p>
345 <td>none (prevents auto-enhancement to use native control)</td>
349 <td>swatch letter (a-z) - Added to the form element</td>
353 <h2><a href="../forms/selects/">Select</a></h2>
354 <p>All <code>select</code> form elements are auto-enhanced, no <code>data-role</code> required</p>
358 <td>home | delete | plus | arrow-u | arrow-d | check | gear | grid | star | custom | arrow-r | arrow-l | minus | refresh | forward | back | alert | info | search</td>
361 <th>data-iconpos</th>
362 <td><strong>left</strong> | right | top | bottom | notext</td>
366 <td>true | <strong>false</strong></td>
369 <th>data-native-menu</th>
370 <td><strong>true</strong> | false</td>
373 <th>data-overlay-theme</th>
374 <td>swatch letter (a-z) - overlay theme for non-native selects</td>
377 <th>data-placeholder</th>
378 <td>true | false - Add to the Option</td>
382 <td>none (prevents auto-enhancement to use native control)</td>
386 <td>swatch letter (a-z) - Added to the form element</td>
389 <p>Multiple selects can be wrapped in a fieldset with a <code>data-role="controlgroup"</code> attribute for a vertically grouped set. Add the <code>data-type="horizontal"</code> attribute for the selects to sit side-by-side.</p>
391 <h2><a href="../forms/slider/">Slider</a></h2>
392 <p>Inputs with <code>type="range"</code> are auto-enhanced, no <code>data-role</code> required</p>
396 <td>none (prevents auto-enhancement to use native control)</td>
400 <td>swatch letter (a-z) - Added to the form element</td>
403 <th>data-track-theme</th>
404 <td>swatch letter (a-z) - Added to the form element</td>
408 <h2><a href="../forms/textinputs/">Text input & Textarea</a></h2>
409 <p>Input <code>type="text|number|search|etc."</code> or <code>textarea</code> elements are auto-enhanced, no <code>data-role</code> required</p>
413 <td>none (prevents auto-enhancement to use native control)</td>
417 <td>swatch letter (a-z) - Added to the form element</td>
421 </div><!--/content -->
423 <div class="content-secondary">
425 <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
427 <h3>More in this section</h3>
429 <ul data-role="listview" data-theme="c" data-dividertheme="d">
431 <li data-role="list-divider">API</li>
432 <li><a href="../../docs/api/globalconfig.html">Configuring defaults</a></li>
433 <li><a href="../../docs/api/events.html">Events</a></li>
434 <li><a href="../../docs/api/methods.html">Methods & Utilities</a></li>
435 <li data-theme="a"><a href="../../docs/api/data-attributes.html">Data attribute reference</a></li>
436 <li><a href="../../docs/api/themes.html">Theme framework</a></li>
441 </div><!-- /content -->
443 <div data-role="footer" class="footer-docs" data-theme="c">
444 <p>© 2011 The jQuery Project</p>