lists-themes.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>jQuery Mobile Docs - Theming Lists</title>
  7. <link rel="stylesheet" href="../../jquery.mobile-1.0.1.min.css" />
  8. <link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
  9. <script src="../../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="../../jquery.mobile-1.0.1.min.js"></script>
  13. </head>
  14. <body>
  15. <div data-role="page" class="type-interior">
  16. <div data-role="header" data-theme="f">
  17. <h1>Theming lists</h1>
  18. <a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
  19. </div><!-- /header -->
  20. <div data-role="content" class="ui-body">
  21. <div class="content-primary">
  22. <p>All the standard button swatches can be applied to lists. The framework assigns a default list theme swatch of &quot;c&quot; (silver in the default theme) and swatch &quot;b&quot; (blue in default theme) for dividers. Below is a default themed list.</p>
  23. <code>
  24. &lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot;&gt;
  25. </code>
  26. <ul data-role="listview" data-inset="true" data-icon="star">
  27. <li data-role="list-divider">Divider</li>
  28. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  29. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  30. <li><a href="index.html">Sent <span class="ui-li-count">328</span></a></li>
  31. </ul>
  32. <h2>Theming list items</h2>
  33. <p>The list item color scheme can be changed to any button color theme swatch by adding the <code> data-theme</code> attribute to the list, and setting the letter theme swatch. Here is the same list above with the &quot;a&quot; swatch applied. </p>
  34. <code>
  35. &lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot; data-theme=&quot;d&quot;&gt;
  36. </code>
  37. <ul data-role="listview" data-inset="true" data-theme="d">
  38. <li data-role="list-divider">Divider</li>
  39. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  40. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  41. <li><a href="index.html">Sent <span class="ui-li-count">328</span></a></li>
  42. </ul>
  43. <p> data-theme attributes also work at the LI-level, for styling a single item.</p>
  44. <ul data-role="listview" data-inset="true" data-theme="d">
  45. <li data-role="list-divider">Divider</li>
  46. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  47. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  48. <li><a href="index.html">Sent <span class="ui-li-count">328</span></a></li>
  49. <li data-theme="a"><a href="index.html">Trash <span class="ui-li-count">34</span></a></li>
  50. </ul>
  51. <h2>Theming dividers</h2>
  52. <p>The theme for <strong>list dividers</strong> can be set by adding the <code>data-divider-theme</code> to the list and specifying a swatch letter. Here is an example of the same list above with swatch &quot;d&quot; set on the dividers.</p>
  53. <code>
  54. &lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot; data-theme=&quot;d&quot; data-divider-theme=&quot;e&quot;&gt;
  55. </code>
  56. <ul data-role="listview" data-inset="true" data-theme="d" data-divider-theme="e">
  57. <li data-role="list-divider">Divider</li>
  58. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  59. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  60. <li><a href="index.html">Sent <span class="ui-li-count">328</span></a></li>
  61. </ul>
  62. <h2>Theming count bubbles</h2>
  63. <p>The theme for <strong>count bubbles</strong> can be set by adding the <code>data-count-theme</code> to the list and specifying a swatch letter. Here is an example with swatch &quot;e&quot; set on the dividers.</p>
  64. <code>
  65. &lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot; data-theme=&quot;d&quot; data-divider-theme=&quot;e&quot; data-count-theme=&quot;b&quot;&gt;
  66. </code>
  67. <ul data-role="listview" data-inset="true" data-theme="d" data-divider-theme="e" data-count-theme="b">
  68. <li data-role="list-divider">Divider</li>
  69. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  70. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  71. <li><a href="index.html">Sent <span class="ui-li-count">328</span></a></li>
  72. </ul>
  73. <h2>Theming icons</h2>
  74. <p>The default icon for each list item is <code>arrow-r</code>. To override this, set the <code> data-icon</code> attribute on the desired list item to the <a href="../buttons/buttons-icons.html">name of a standard icon</a>. To prevent icons from appearing altogether, set the <code> data-icon</code> attribute to &quot;false&quot;.</p>
  75. <pre>
  76. <code>
  77. &lt;li data-icon=&quot;info&quot;&gt;&lt;a href="#"&gt;Notices&lt;/a&gt;&lt;/li&gt;
  78. &lt;li data-icon=&quot;alert&quot;&gt;&lt;a href="#"&gt;Alerts&lt;/a&gt;&lt;/li&gt;
  79. &lt;li data-icon=&quot;false&quot;&gt;&lt;a href="#"&gt;No icon&lt;/a&gt;&lt;/li&gt;
  80. </code>
  81. </pre>
  82. <ul data-role="listview" data-inset="true">
  83. <li data-role="list-divider">Divider</li>
  84. <li data-icon="info"><a href="#">Notices</a></li>
  85. <li data-icon="alert"><a href="#">Alerts</a></li>
  86. <li data-icon="false"><a href="#">No icon</a></li>
  87. </ul>
  88. <h2>Theming split buttons</h2>
  89. <p>For split lists which a second button, the framework default to &quot;b&quot; for the theme swatch (blue in the default theme) Here is a default split list:</p>
  90. <ul data-role="listview" data-inset="true">
  91. <li><a href="index.html">
  92. <img src="images/album-bb.jpg" />
  93. <h3>Broken Bells</h3>
  94. <p>Broken Bells</p></a>
  95. <a href="index.html">Purchase album</a>
  96. </li>
  97. <li><a href="index.html">
  98. <img src="images/album-hc.jpg" />
  99. <h3>Warning</h3>
  100. <p>Hot Chip</p></a>
  101. <a href="index.html">Purchase album</a>
  102. </li>
  103. </ul>
  104. <code>
  105. &lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot; data-split-theme=&quot;a&quot;&gt;
  106. </code>
  107. <p>To specify the color swatch for the icon button on the right, add the <code>data-split-theme</code> to the list and specify a swatch letter. This attribute can also be added to individual split inside list items by adding a <code> data-theme</code> attribute to specific links (see second list item).</p>
  108. <ul data-role="listview" data-inset="true" data-split-theme="a">
  109. <li><a href="index.html">
  110. <img src="images/album-bb.jpg" />
  111. <h3>Broken Bells</h3>
  112. <p>Broken Bells</p>
  113. </a>
  114. <a href="index.html">Purchase album</a>
  115. </li>
  116. <li><a href="index.html">
  117. <img src="images/album-hc.jpg" />
  118. <h3>Warning</h3>
  119. <p>Hot Chip</p>
  120. </a>
  121. <a href="index.html" data-theme="e">Purchase album</a>
  122. </li>
  123. </ul>
  124. <p>The icon for the split theme can set at the list level by adding the <code>data-split-icon</code> to the list and specifying a <a href="../buttons/buttons-icons.html">standard icon</a>. This attribute can also be added to individual split inside list items by adding a <code> data-icon</code> attribute to specific links (see second list item).</p>
  125. <code>
  126. &lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot; data-split-theme=&quot;d&quot; data-split-icon=&quot;delete&quot;&gt;
  127. </code>
  128. <ul data-role="listview" data-inset="true" data-split-theme="d" data-split-icon="delete" >
  129. <li><a href="index.html">
  130. <img src="images/album-bb.jpg" />
  131. <h3>Broken Bells</h3>
  132. <p>Broken Bells</p>
  133. </a>
  134. <a href="index.html">Purchase album</a>
  135. </li>
  136. <li><a href="index.html">
  137. <img src="images/album-hc.jpg" />
  138. <h3>Warning</h3>
  139. <p>Hot Chip</p>
  140. </a>
  141. <a href="index.html">Purchase album</a>
  142. </li>
  143. </ul>
  144. <h2>Examples of all basic list swatches</h2>
  145. <p><strong>A</strong> swatch</p>
  146. <ul data-role="listview" data-inset="true" data-theme="a">
  147. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  148. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  149. <li><a href="index.html">Trash <span class="ui-li-count">62</span></a></li>
  150. </ul>
  151. <p><strong>B</strong> swatch</p>
  152. <ul data-role="listview" data-inset="true" data-theme="b">
  153. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  154. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  155. <li><a href="index.html">Trash <span class="ui-li-count">62</span></a></li>
  156. </ul>
  157. <p><strong>C</strong> swatch</p>
  158. <ul data-role="listview" data-inset="true" data-theme="c">
  159. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  160. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  161. <li><a href="index.html">Trash <span class="ui-li-count">62</span></a></li>
  162. </ul>
  163. <p><strong>D</strong> swatch</p>
  164. <ul data-role="listview" data-inset="true" data-theme="d">
  165. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  166. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  167. <li><a href="index.html">Trash <span class="ui-li-count">62</span></a></li>
  168. </ul>
  169. <p><strong>E</strong> swatch</p>
  170. <ul data-role="listview" data-inset="true" data-theme="e">
  171. <li><a href="index.html">Inbox <span class="ui-li-count">12</span></a></li>
  172. <li><a href="index.html">Outbox <span class="ui-li-count">0</span></a></li>
  173. <li><a href="index.html">Trash <span class="ui-li-count">62</span></a></li>
  174. </ul>
  175. </div><!--/content-primary -->
  176. <div class="content-secondary">
  177. <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
  178. <h3>More in this section</h3>
  179. <ul data-role="listview" data-theme="c" data-dividertheme="d">
  180. <li data-role="list-divider">List views</li>
  181. <li><a href="docs-lists.html">List markup conventions</a></li>
  182. <li><a href="lists-ul.html">Basic linked list</a></li>
  183. <li><a href="lists-nested.html">Nested list</a></li>
  184. <li><a href="lists-ol.html">Numbered list</a></li>
  185. <li><a href="lists-split.html">Split button list</a></li>
  186. <li><a href="lists-divider.html">List dividers</a></li>
  187. <li><a href="lists-count.html">Count bubble</a></li>
  188. <li><a href="lists-thumbnails.html">Thumbnails</a></li>
  189. <li><a href="lists-icons.html">Icons</a></li>
  190. <li><a href="lists-formatting.html">Content formatting</a></li>
  191. <li><a href="lists-search.html">Search filter bar</a></li>
  192. <li><a href="lists-search-inset.html">Inset search filter bar</a></li>
  193. <li><a href="lists-search-with-dividers.html">Search filter bar with dividers</a></li>
  194. <li><a href="lists-search-filtertext.html">Search filter hidden data</a></li>
  195. <li><a href="lists-readonly.html">Read-only lists</a></li>
  196. <li><a href="lists-readonly-inset.html">Read-only inset lists</a></li>
  197. <li><a href="lists-forms.html">Lists with forms</a></li>
  198. <li><a href="lists-forms-inset.html">Inset lists with forms</a></li>
  199. <li><a href="lists-inset.html">Inset styled lists</a></li>
  200. <li><a href="lists-performance.html">List performance test</a></li>
  201. <li data-theme="a"><a href="lists-themes.html">Theming lists</a></li>
  202. </ul>
  203. </div>
  204. </div>
  205. </div><!-- /content -->
  206. <div data-role="footer" class="footer-docs" data-theme="c">
  207. <p>&copy; 2011-2012 The jQuery Project</p>
  208. </div>
  209. </div><!-- /page -->
  210. </body>
  211. </html>