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.

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