1
0

segmented_controls.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Segmented controls - Puppertino Framework</title>
  6. <link
  7. href="https://rsms.me/inter/inter.css"
  8. rel="stylesheet"
  9. />
  10. <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/codedgar/Puppertino@latest/dist/css/newfull.css" />
  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 Segmented controls 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="segmented_controls.html" class="p-btn p-btn-scope">Segmented controls</a>
  44. </div>
  45. <h1>Segmented controls</h1>
  46. <div class="master">
  47. <p>
  48. Segmented controls are commonly used to toggle diffent states or views in your website or App and are greatly featured in many apps in iOS. You can use the segmented buttons by using the
  49. <a
  50. href="https://github.com/codedgar/Puppertino/blob/master/dist/css/segmented-controls.css"
  51. target="_blank"
  52. >CSS of Segmented controls</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. (Not recommended if you are just going to use this component) and the
  61. <a
  62. href="https://github.com/codedgar/Puppertino/blob/master/src/js/segmented_controls.js"
  63. target="_blank"
  64. >JavaScript</a
  65. > of the component.
  66. </p>
  67. <div class="talk-about-it">
  68. <h3>Note on Previous Versions</h3>
  69. <p>In earlier versions of Puppertino, segmented controls 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>
  70. </div>
  71. <div class="talk-about-it">
  72. <h2>General Usage of the segmented controls.</h2>
  73. <p>
  74. Segmented controls are made of 2 main elements, the container and the links inside of them which can include SVGs or plain text. The container features the main class, <code class="code">p-segmented-controls</code> and the links inside of it don't need to feature any class in particular, just <code class="code">active</code> for the active control. There also <a href="#modifier">Modifier classes</a> to change the default look of the segmented controls.<br><br>
  75. Keep in mind that while the Segmented controls component features a JS, it does not manage states, views or any type of functionality, if you wish to manage these states you will have to create a JS that accomplishes what you want to do.
  76. </p>
  77. <div class="content_smol">
  78. <div class="mw-300">
  79. <div class="p-segmented-controls">
  80. <a href="#" class="active">Roadmap</a>
  81. <button>Satelite</button>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="content_smol">
  86. <div class="mw-300">
  87. <div class="p-segmented-controls">
  88. <a href="#" class="active"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><line x1="17" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="17" y1="18" x2="3" y2="18"></line></svg></a>
  89. <a href="#"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><line x1="21" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="3" y2="18"></line></svg></a>
  90. <a href="#"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><line x1="19" y1="4" x2="10" y2="4"></line><line x1="14" y1="20" x2="5" y2="20"></line><line x1="15" y1="4" x2="9" y2="20"></line></svg></a>
  91. <a href="#"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><path d="M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"></path><path d="M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"></path></svg></a>
  92. <a href="#"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"></path></svg></a>
  93. <a href="#"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg></a>
  94. </div>
  95. </div>
  96. </div>
  97. <p>Usage:</p>
  98. <div class="code">
  99. <pre>
  100. <code class="html">
  101. &#60;div class="p-segmented-controls">
  102. &#60;a href="#" class="active">Roadmap&#60;/a>
  103. &#60;a href="#">Satelite&#60;/a>
  104. &#60;/div>
  105. </code>
  106. </pre>
  107. </div>
  108. </div>
  109. <div class="talk-about-it" id="modifier">
  110. <h2>Modifier classes.</h2>
  111. <p>
  112. If the original look of the segmented control does not click with you right away fear not! We have created 5 different variations for any taste! Like these:
  113. </p>
  114. <div class="content_smol">
  115. <div class="mw-300">
  116. <div class="p-segmented-controls p-segmented-radius">
  117. <a href="#" class="active">Doom</a>
  118. <a href="#">Quake</a>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="content_smol">
  123. <div class="mw-300">
  124. <div class="p-segmented-controls p-segmented-radius p-segmented-internal-radius">
  125. <a href="#" class="active">FIFA</a>
  126. <a href="#">PES</a>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="content_smol">
  131. <div class="mw-300">
  132. <div class="p-segmented-controls p-segmented-controls-alt">
  133. <a href="#" class="active">Thing</a>
  134. <a href="#">Stuff</a>
  135. <a href="#">Other</a>
  136. </div>
  137. </div>
  138. </div>
  139. <div class="content_smol">
  140. <div class="mw-300">
  141. <div class="p-segmented-controls p-segmented-outline">
  142. <a href="#" class="active">Can</a>
  143. <a href="#">Dog</a>
  144. <a href="#">Pup</a>
  145. </div>
  146. </div>
  147. </div>
  148. <div class="content_smol">
  149. <div class="mw-300">
  150. <div class="p-segmented-controls p-segmented-controls-outline-alt">
  151. <a href="#" class="active">Mini</a>
  152. <a href="#">May</a>
  153. <a href="#">Moe</a>
  154. </div>
  155. </div>
  156. </div>
  157. <p>Usage:</p>
  158. <div class="code">
  159. <pre>
  160. <code class="html">
  161. &#60;div class="p-segmented-controls p-segmented-radius">
  162. &#60;a href="#" class="active">Doom&#60;/a>
  163. &#60;a href="#">Quake&#60;/a>
  164. &#60;/div>
  165. &#60;div class="p-segmented-controls p-segmented-radius p-segmented-internal-radius">
  166. &#60;a href="#" class="active">FIFA&#60;/a>
  167. &#60;a href="#">PES&#60;/a>
  168. &#60;/div>
  169. &#60;div class="p-segmented-controls p-segmented-controls-alt">
  170. &#60;a href="#" class="active">Thing&#60;/a>
  171. &#60;a href="#">Stuff&#60;/a>
  172. &#60;a href="#">Other&#60;/a>
  173. &#60;/div>
  174. &#60;div class="p-segmented-controls p-segmented-outline">
  175. &#60;a href="#" class="active">Can&#60;/a>
  176. &#60;a href="#">Dog&#60;/a>
  177. &#60;a href="#">Pup&#60;/a>
  178. &#60;/div>
  179. &#60;div class="p-segmented-controls p-segmented-controls-outline-alt">
  180. &#60;a href="#" class="active">Mini&#60;/a>
  181. &#60;a href="#">May&#60;/a>
  182. &#60;a href="#">Moe&#60;/a>
  183. &#60;/div>
  184. </code>
  185. </pre>
  186. </div>
  187. </div>
  188. <div class="talk-about-it">
  189. <h2>Color customization.</h2>
  190. <p>
  191. Ah yes, beatiful customization! Well, for the segmented controls component, We've made the color customization fairly simple, just change the <code class="code">--color-segmented</code> and/or <code class="code">--color-lighter-segment</code> (For the lighter segmented control) variables. For example, the <code class="code">p-segmented-grey</code> class (Included in the CSS) changes the color of all the segmented controls by overriding these variables, like so:
  192. </p>
  193. <div class="content_smol">
  194. <div class="mw-300">
  195. <div class="p-segmented-controls p-segmented-grey">
  196. <a href="#" class="active">Roadmap</a>
  197. <a href="#">Satelite</a>
  198. </div>
  199. </div>
  200. </div>
  201. <div class="content_smol">
  202. <div class="mw-300">
  203. <div class="p-segmented-controls demo_segmented">
  204. <a href="#" class="active">Roadmap</a>
  205. <a href="#">Satelite</a>
  206. </div>
  207. </div>
  208. </div>
  209. <p>Usage:</p>
  210. <div class="code">
  211. <pre>
  212. <code class="html">
  213. &#60;div class="p-segmented-controls p-segmented-grey">
  214. &#60;a href="#" class="active">Roadmap&#60;/a>
  215. &#60;a href="#">Satelite&#60;/a>
  216. &#60;/div>
  217. </code>
  218. </pre>
  219. </div>
  220. </div>
  221. <div class="talk-about-it">
  222. <h2>One more thing.</h2>
  223. <p>
  224. While yes, segmented controls are really sexy, please keep in mind that you should only use one word or small icons in them. Otherwise you will make the segmented control overflow and that doesn't look nice. Keep it simple, you know!
  225. </p>
  226. </div>
  227. </div>
  228. </body>
  229. <script src="https://cdn.jsdelivr.net/gh/codedgar/Puppertino@latest/src/js/dakmode_manager.js"></script>
  230. <script
  231. type="text/javascript"
  232. src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/highlight.min.js"
  233. ></script>
  234. <script defer>
  235. hljs.initHighlightingOnLoad();
  236. </script>
  237. <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/codedgar/Puppertino@latest/src/js/segmented_controls.js"></script>
  238. </html>