You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

415 lines
14 KiB

  1. ---
  2. layout : 'default'
  3. css : 'accordion'
  4. title : 'Accordion'
  5. description : 'An accordion displays a single piece of content, while allowing the option of displaying other related content'
  6. type : 'UI Module'
  7. ---
  8. <script src="/javascript/accordion.js"></script>
  9. <%- @partial('header', { tabs: 'module' }) %>
  10. <div class="main container">
  11. <div class="ui active tab" data-tab="definition">
  12. <div class="peek">
  13. <div class="ui vertical pointing secondary menu">
  14. <a class="active item">Types</a>
  15. <a class="item">Variations</a>
  16. <a class="item">Behaviors</a>
  17. </div>
  18. </div>
  19. <h2 class="ui dividing header">Types</h2>
  20. <div class="example">
  21. <h4 class="ui header">Accordion</h4>
  22. <p>A standard accordion</p>
  23. <div class="ui accordion">
  24. <div class="active title">
  25. <i class="dropdown icon"></i>
  26. What is a dog?
  27. </div>
  28. <div class="active content">
  29. <p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
  30. </div>
  31. <div class="title">
  32. <i class="dropdown icon"></i>
  33. What kinds of dogs are there?
  34. </div>
  35. <div class="content">
  36. <p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
  37. </div>
  38. <div class="title">
  39. <i class="dropdown icon"></i>
  40. How do you acquire a dog?
  41. </div>
  42. <div class="content">
  43. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  44. <p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="example">
  49. <h4 class="ui header">Basic</h4>
  50. <p>A basic accordion does not add any extra formatting</p>
  51. <div class="ui basic accordion">
  52. <div class="active title">
  53. <i class="dropdown icon"></i>
  54. What is a dog?
  55. </div>
  56. <div class="active content">
  57. <p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
  58. </div>
  59. <div class="title">
  60. <i class="dropdown icon"></i>
  61. What kinds of dogs are there?
  62. </div>
  63. <div class="content">
  64. <p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
  65. </div>
  66. <div class="title">
  67. <i class="dropdown icon"></i>
  68. How do you acquire a dog?
  69. </div>
  70. <div class="content">
  71. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  72. <p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
  73. </div>
  74. </div>
  75. </div>
  76. <h2 class="ui dividing header">Variations</h2>
  77. <div class="example">
  78. <h4 class="ui header">Fluid</h4>
  79. <p>An accordion can take up the width of its container</p>
  80. <div class="ui fluid accordion">
  81. <div class="active title">
  82. <i class="dropdown icon"></i>
  83. What is a dog?
  84. </div>
  85. <div class="active content">
  86. <p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
  87. </div>
  88. <div class="title">
  89. <i class="dropdown icon"></i>
  90. What kinds of dogs are there?
  91. </div>
  92. <div class="content">
  93. <p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
  94. </div>
  95. <div class="title">
  96. <i class="dropdown icon"></i>
  97. How do you acquire a dog?
  98. </div>
  99. <div class="content">
  100. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  101. <p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
  102. </div>
  103. </div>
  104. </div>
  105. <h2 class="ui dividing header">Behavior</h2>
  106. All the following behaviors can be called using the syntax <code>$('.foo').accordion('behavior name', argumentOne, argumentTwo)</code>
  107. <table class="ui definition celled table segment">
  108. <tr>
  109. <td>open (index)</td>
  110. <td>Opens accordion content at index</td>
  111. </tr>
  112. <tr>
  113. <td>close (index)</td>
  114. <td>Closes accordion content at index</td>
  115. </tr>
  116. <tr>
  117. <td>toggle (index)</td>
  118. <td>Closes accordion content at index</td>
  119. </tr>
  120. </table>
  121. </div>
  122. <div class="ui tab" data-tab="examples">
  123. <div class="example">
  124. <h4 class="ui header">Form</h4>
  125. <p>An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.</p>
  126. <div class="ui basic accordion form">
  127. <div class="two fields">
  128. <div class="field">
  129. <label>First Name</label>
  130. <input placeholder="First Name" type="text">
  131. </div>
  132. <div class="field">
  133. <label>Last Name</label>
  134. <input placeholder="Last Name" type="text">
  135. </div>
  136. </div>
  137. <div class="title">
  138. <i class="icon dropdown"></i>
  139. Optional Details
  140. </div>
  141. <div class="content">
  142. <div class="field">
  143. <label>Maiden Name</label>
  144. <input placeholder="Maiden Name" type="text">
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="example">
  150. <h4 class="ui header">Menu</h4>
  151. <p>An accordion can be used to create content drawers inside a menu</p>
  152. <div class="ui basic vertical accordion menu">
  153. <div class="item">
  154. <a class="active title">
  155. <i class="dropdown icon"></i>
  156. Size
  157. </a>
  158. <div class="active content menu">
  159. <div class="ui form item">
  160. <div class="grouped inline fields">
  161. <div class="field">
  162. <div class="ui radio checkbox">
  163. <input type="radio" name="size" value="small" />
  164. <label></label>
  165. </div>
  166. <label>Small</label>
  167. </div>
  168. <div class="field">
  169. <div class="ui radio checkbox">
  170. <input type="radio" name="size" value="medium" />
  171. <label></label>
  172. </div>
  173. <label>Medium</label>
  174. </div>
  175. <div class="field">
  176. <div class="ui radio checkbox">
  177. <input type="radio" name="size" value="large" />
  178. <label></label>
  179. </div>
  180. <label>Large</label>
  181. </div>
  182. <div class="field">
  183. <div class="ui radio checkbox">
  184. <input type="radio" name="size" value="x-large" />
  185. <label></label>
  186. </div>
  187. <label>X-Large</label>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. <div class="item">
  194. <a class="active title">
  195. <i class="dropdown icon"></i>
  196. Colors
  197. </a>
  198. <div class="active content menu">
  199. <div class="ui form item">
  200. <div class="grouped inline fields">
  201. <div class="field">
  202. <div class="ui checkbox">
  203. <input type="checkbox" name="small" />
  204. <label></label>
  205. </div>
  206. <label>Red</label>
  207. </div>
  208. <div class="field">
  209. <div class="ui checkbox">
  210. <input type="checkbox" name="medium" />
  211. <label></label>
  212. </div>
  213. <label>Orange</label>
  214. </div>
  215. <div class="field">
  216. <div class="ui checkbox">
  217. <input type="checkbox" name="large" />
  218. <label></label>
  219. </div>
  220. <label>Green</label>
  221. </div>
  222. <div class="field">
  223. <div class="ui checkbox">
  224. <input type="checkbox" name="x-large" />
  225. <label></label>
  226. </div>
  227. <label>Blue</label>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <div class="ui tab" data-tab="usage">
  237. <h3 class="ui header">Initializing an accordion</h3>
  238. <div class="code">
  239. $('.ui.accordion')
  240. .accordion()
  241. ;
  242. </div>
  243. </div>
  244. <div class="ui tab" data-tab="settings">
  245. <h3 class="ui header">
  246. Accordion Settings
  247. <div class="sub header">Accordion settings modify its behavior</div>
  248. </h3>
  249. <table class="ui sortable celled definition table segment">
  250. <thead>
  251. <th>Setting</th>
  252. <th class="four wide">Default</th>
  253. <th>Description</th>
  254. </thead>
  255. <tbody>
  256. <tr>
  257. <td>exclusive</td>
  258. <td>true</td>
  259. <td>Set to false to allow multiple sections to be open at the same time</td>
  260. </tr>
  261. <tr>
  262. <td>collapsible</td>
  263. <td>true</td>
  264. <td>Set to false to require an accordion to always have a section open</td>
  265. </tr>
  266. <tr>
  267. <td>duration</td>
  268. <td>500</td>
  269. <td>Duration in ms of opening animation</td>
  270. </tr>
  271. <tr>
  272. <td>easing</td>
  273. <td>easeInOutQuint</td>
  274. <td>EaseInOutQuint is included with accordion, for additional options consider <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing</a>)</td>
  275. </tr>
  276. </tbody>
  277. </table>
  278. <h3 class="ui header">
  279. Callbacks
  280. <div class="sub header">Callback settings specify a function to occur after a specific behavior.</div>
  281. </h3>
  282. <table class="ui sortable celled definition table segment">
  283. <thead>
  284. <th class="four wide">Setting</th>
  285. <th>Context</th>
  286. <th>Description</th>
  287. </thead>
  288. <tbody>
  289. <tr>
  290. <td>onOpen</td>
  291. <td>active content</td>
  292. <td>Callback on element open</td>
  293. </tr>
  294. <tr>
  295. <td>onClose</td>
  296. <td>active content</td>
  297. <td>Callback on element close</td>
  298. </tr>
  299. <tr>
  300. <td>onChange</td>
  301. <td>active content</td>
  302. <td>Callback on element open or close</td>
  303. </tr>
  304. </tbody>
  305. </table>
  306. <h3 class="ui header">
  307. DOM Settings
  308. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  309. </h3>
  310. <table class="ui sortable celled definition table segment">
  311. <thead>
  312. <th>Setting</th>
  313. <th class="six wide">Default</th>
  314. <th>Description</th>
  315. </thead>
  316. <tbody>
  317. <tr>
  318. <td>namespace</td>
  319. <td>accordion</td>
  320. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  321. </tr>
  322. <tr>
  323. <td>selector</td>
  324. <td>
  325. <div class="code" data-type="css">{
  326. title : '.title',
  327. content : '.content'
  328. }
  329. </div>
  330. </td>
  331. <td>Object containing selectors used by module.</td>
  332. </tr>
  333. <tr>
  334. <td>className</td>
  335. <td>
  336. <div class="code">
  337. className : {
  338. active : 'active'
  339. },
  340. </div>
  341. </td>
  342. <td>Class names used to attach style to state</td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. <h3 class="ui header">
  347. Debug Settings
  348. <div class="sub header">Debug settings controls debug output to the console</div>
  349. </h3>
  350. <table class="ui sortable celled definition table segment">
  351. <thead>
  352. <th>Setting</th>
  353. <th class="four wide">Default</th>
  354. <th>Description</th>
  355. </thead>
  356. <tbody>
  357. <tr>
  358. <td>name</td>
  359. <td>Accordion</td>
  360. <td>Name used in debug logs</td>
  361. </tr>
  362. <tr>
  363. <td>debug</td>
  364. <td>True</td>
  365. <td>Provides standard debug output to console</td>
  366. </tr>
  367. <tr>
  368. <td>performance</td>
  369. <td>True</td>
  370. <td>Provides standard debug output to console</td>
  371. </tr>
  372. <tr>
  373. <td>verbose</td>
  374. <td>True</td>
  375. <td>Provides ancillary debug output to console</td>
  376. </tr>
  377. <tr>
  378. <td>errors</td>
  379. <td colspan="2">
  380. <div class="code">
  381. error : {
  382. method : 'The method you called is not defined.',
  383. notFound : 'There were no elements that matched the specified selector'
  384. }
  385. </div>
  386. </td>
  387. </tr>
  388. </tbody>
  389. </table>
  390. </div>
  391. </div>
  392. </body>
  393. </html>