tabs.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Tabs - Puppertino Framework</title>
  5. <link
  6. href="https://rsms.me/inter/inter.css"
  7. rel="stylesheet"
  8. />
  9. <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/codedgar/Puppertino@latest/dist/css/newfull.css" />
  10. <meta charset="utf-8" />
  11. <meta
  12. name="viewport"
  13. content="width=device-width, initial-scale=1, shrink-to-fit=no"
  14. />
  15. <meta http-equiv="x-ua-compatible" content="ie=edge" />
  16. <link rel="stylesheet" type="text/css" href="doc.css" />
  17. <meta
  18. name="description"
  19. content="This is the documentation for Tabs on the Puppertino Framework, a framework that mimics Apple's design, woof!"
  20. />
  21. <link rel="icon" type="image/png" href="../landing-images/doggo.png" />
  22. <!-- Global site tag (gtag.js) - Google Analytics -->
  23. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-176821843-1"></script>
  24. <script>
  25. window.dataLayer = window.dataLayer || [];
  26. function gtag(){dataLayer.push(arguments);}
  27. gtag('js', new Date());
  28. gtag('config', 'UA-176821843-1');
  29. </script>
  30. </head>
  31. <body class="p-layout">
  32. <div class="route">
  33. <a
  34. href="https://codedgar.github.io/Puppertino/"
  35. class="p-btn p-btn-scope p-btn-scope-unactive"
  36. >Puppertino</a
  37. >
  38. <p>/</p>
  39. <a href="index.html" class="p-btn p-btn-scope p-btn-scope-unactive"
  40. >Examples</a
  41. >
  42. <p>/</p>
  43. <a href="tabs.html" class="p-btn p-btn-scope">Tabs</a>
  44. </div>
  45. <h1></h1>
  46. <div class="master">
  47. <p>
  48. Tabs are greatly used on iOS and macOS apps, and this is a component that was a long time in the making. Desktop tabs where created by <a href="https://github.com/jesusrobot" target="_blank">jesusrobot</a> so props to him for helping out! To use the Tabs components, you can use the tab component by using the
  49. <a
  50. href="https://github.com/codedgar/Puppertino/blob/master/dist/css/tabs.css"
  51. target="_blank"
  52. >CSS of Tabs</a
  53. >
  54. or
  55. <a
  56. href="https://github.com/codedgar/Puppertino/blob/master/dist/css/newfull.css"
  57. target="_blank"
  58. >downloading the full CSS</a
  59. >
  60. and
  61. <a
  62. href="https://github.com/codedgar/Puppertino/blob/master/src/js/tabs.js"
  63. target="_blank"
  64. >downloading the JS for tabs</a
  65. >
  66. (Not recommended if you are just going to use this component).
  67. </p>
  68. <div class="talk-about-it">
  69. <h3>Note on Previous Versions</h3>
  70. <p>In earlier versions of Puppertino, tabs were exclusively links. In the latest version, you now have the option to use either <strong>Buttons</strong> or <strong>Links</strong>, offering greater flexibility for appropriate actions while maintaining proper semantics and accessibility.</p>
  71. </div>
  72. <div class="talk-about-it">
  73. <h2>Desktop tabs.</h2>
  74. <p>
  75. The desktop tabs are composed of two main parts. First the tabs and then the panels with the content. You can add more tabs by just adding buttons inside the <code class="code">p-tabs</code> and more panels inside the <code class="code">p-panels</code> with their respective classes. The toggling of the tabs is managed by the JavaScript of the component.
  76. </p>
  77. <div class="p-tabs-container" id="tabs1">
  78. <div class="p-tabs">
  79. <button class="p-tab p-is-active">Service 1</button>
  80. <button class="p-tab">Service 2</button>
  81. <button class="p-tab">Service 3</button>
  82. </div>
  83. <div class="p-panels">
  84. <div class="p-panel p-is-active">
  85. <h1>Service 1</h1>
  86. <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem architecto et unde ut eligendi repudiandae nostrum id rerum perferendis. Architecto vel, in accusantium tempore dolore enim accusamus molestiae ex nisi? Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem architecto et unde ut eligendi repudiandae nostrum id rerum perferendis. Architecto vel, in accusantium tempore dolore enim accusamus molestiae ex nisi?Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem architecto et unde ut eligendi repudiandae nostrum id rerum perferendis. Architecto vel, in accusantium tempore dolore enim accusamus molestiae ex nisi?</p>
  87. </div>
  88. <div class="p-panel">
  89. <h1>Service 2</h1>
  90. <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem architecto et unde ut eligendi repudiandae nostrum id rerum perferendis. Architecto vel, in accusantium tempore dolore enim accusamus molestiae ex nisi?</p>
  91. </div>
  92. <div class="p-panel">
  93. <h1>Service 3</h1>
  94. <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem architecto et unde ut eligendi repudiandae nostrum id rerum perferendis. Architecto vel, in accusantium tempore dolore enim accusamus molestiae ex nisi?</p>
  95. </div>
  96. </div>
  97. </div>
  98. <p>Usage:</p>
  99. <div class="code">
  100. <!-- -->
  101. <pre>
  102. <code class="html">
  103. &#60;div class="p-tabs-container" id="tab_example">
  104. &#60;div class="p-tabs">
  105. &#60;button class="p-tab p-is-active">Service 1&#60;/button>
  106. &#60;button class="p-tab">Service 2&#60;/button>
  107. &#60;button class="p-tab">Service 3&#60;/button>
  108. &#60;/div>
  109. &#60;div class="p-panels">
  110. &#60;div class="p-panel p-is-active">
  111. &#60;!-- CONTENT HERE -->
  112. &#60;/div>
  113. &#60;div class="p-panel">
  114. &#60;!-- CONTENT HERE -->
  115. &#60;/div>
  116. &#60;div class="p-panel">
  117. &#60;!-- CONTENT HERE -->
  118. &#60;/div>
  119. &#60;/div>
  120. &#60;/div>
  121. </code>
  122. </pre>
  123. </div>
  124. </div>
  125. <div class="talk-about-it" id="modifier">
  126. <h2>Mobile tabs.</h2>
  127. <p>
  128. Mobile tabs are very different both in functionality and markup to the desktop tabs. To use it you need to have a unique id for every tab and use the attribute <code class="code">data-p-mobile-toggle</code> to change the tab. Every other event is managed by the JavaScript. You can use text, icons or both inside of the mobile controls and it will adapt accordingly.
  129. </p>
  130. <div class="content_smol">
  131. <div class="mw-450">
  132. <div class="p-mobile-tabs-content">
  133. <div class="p-mobile-tabs--content active" id="demo1">
  134. <h1>Hello</h1>
  135. <p> This is the first tab </p>
  136. </div>
  137. <div class="p-mobile-tabs--content" id="demo2">
  138. <h1>Hello2</h1>
  139. <p> This is the second tab </p>
  140. </div>
  141. <div class="p-mobile-tabs--content" id="demo3">
  142. <h1>Hello3</h1>
  143. <p> This is the third tab </p>
  144. </div>
  145. <div class="p-mobile-tabs--content" id="demo4">
  146. <h1>Hello4</h1>
  147. <p> This is the fourth tab </p>
  148. </div>
  149. <div class="p-mobile-tabs">
  150. <div>
  151. <button class="active" data-p-mobile-toggle="#demo1">
  152. <svg viewBox="0 0 24 24" width="19" height="19" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
  153. Home
  154. </button>
  155. </div>
  156. <div>
  157. <a href="#" data-p-mobile-toggle="#demo2">
  158. <svg viewBox="0 0 24 24" width="19" height="19" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
  159. News
  160. </a>
  161. </div>
  162. <div>
  163. <a href="#" data-p-mobile-toggle="#demo3">
  164. <svg viewBox="0 0 24 24" width="19" height="19" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
  165. Options
  166. </a>
  167. </div>
  168. <div>
  169. <a href="#" data-p-mobile-toggle="#demo4">
  170. <svg viewBox="0 0 24 24" width="19" height="19" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
  171. Account
  172. </a>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. <p>Usage:</p>
  179. <div class="code">
  180. <pre>
  181. <code class="html">
  182. &#60;div class="p-mobile-tabs-content">
  183. &#60;div class="p-mobile-tabs--content active" id="demo1">
  184. &#60;!-- CONTENT HERE -->
  185. &#60;/div>
  186. &#60;div class="p-mobile-tabs--content" id="demo2">
  187. &#60;!-- CONTENT HERE -->
  188. &#60;/div>
  189. &#60;div class="p-mobile-tabs--content" id="demo3">
  190. &#60;!-- CONTENT HERE -->
  191. &#60;/div>
  192. &#60;div class="p-mobile-tabs--content" id="demo4">
  193. &#60;!-- CONTENT HERE -->
  194. &#60;/div>
  195. &#60;div class="p-mobile-tabs">
  196. &#60;div>
  197. &#60;button class="active" data-p-mobile-toggle="#demo1">
  198. &#60;!-- SVG ICON -->
  199. Home
  200. &#60;/button>
  201. &#60;/div>
  202. &#60;div>
  203. &#60;a href="#" data-p-mobile-toggle="#demo2">
  204. &#60;!-- SVG ICON -->
  205. News
  206. &#60;/a>
  207. &#60;/div>
  208. &#60;div>
  209. &#60;a href="#" data-p-mobile-toggle="#demo3">
  210. &#60;!-- SVG ICON -->
  211. Options
  212. &#60;/a>
  213. &#60;/div>
  214. &#60;div>
  215. &#60;a href="#" data-p-mobile-toggle="#demo4">
  216. &#60;!-- SVG ICON -->
  217. Account
  218. &#60;/a>
  219. &#60;/div>
  220. &#60;/div>
  221. &#60;/div>
  222. </code>
  223. </pre>
  224. </div>
  225. </div>
  226. </div>
  227. </body>
  228. <script src="https://cdn.jsdelivr.net/gh/codedgar/Puppertino@latest/src/js/dakmode_manager.js"></script>
  229. <script
  230. type="text/javascript"
  231. src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/highlight.min.js"
  232. ></script>
  233. <script defer>
  234. hljs.initHighlightingOnLoad();
  235. </script>
  236. <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/codedgar/Puppertino@latest/src/js/tabs.js"></script>
  237. </html>