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.

507 lines
17 KiB

11 years ago
  1. ---
  2. layout : 'default'
  3. css : 'accordion'
  4. element : 'accordion'
  5. elementType : 'module'
  6. title : 'Accordion'
  7. description : 'An accordion lets a user activate groups of collapsible content'
  8. type : 'UI Module'
  9. themes : ['Default', 'Chubby']
  10. ---
  11. <link rel="stylesheet/less" type="text/css" href="/build/less/definitions/modules/accordion.less" />
  12. <script src="/javascript/accordion.js"></script>
  13. <%- @partial('header', { tabs: 'module' }) %>
  14. <div class="main container">
  15. <div class="ui active tab" data-tab="definition">
  16. <h2 class="ui dividing header">Types</h2>
  17. <div class="example">
  18. <h4 class="ui header">Accordion</h4>
  19. <p>A standard accordion</p>
  20. <div class="ui accordion">
  21. <div class="active title">
  22. <i class="dropdown icon"></i>
  23. What is a dog?
  24. </div>
  25. <div class="active content">
  26. <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>
  27. </div>
  28. <div class="title">
  29. <i class="dropdown icon"></i>
  30. What kinds of dogs are there?
  31. </div>
  32. <div class="content">
  33. <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>
  34. </div>
  35. <div class="title">
  36. <i class="dropdown icon"></i>
  37. How do you acquire a dog?
  38. </div>
  39. <div class="content">
  40. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  41. <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>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="example">
  46. <h4 class="ui header">Styled</h4>
  47. <p>A styled accordion adds basic formatting</p>
  48. <div class="ui styled accordion">
  49. <div class="active title">
  50. <i class="dropdown icon"></i>
  51. What is a dog?
  52. </div>
  53. <div class="active content">
  54. <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>
  55. </div>
  56. <div class="title">
  57. <i class="dropdown icon"></i>
  58. What kinds of dogs are there?
  59. </div>
  60. <div class="content">
  61. <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>
  62. </div>
  63. <div class="title">
  64. <i class="dropdown icon"></i>
  65. How do you acquire a dog?
  66. </div>
  67. <div class="content">
  68. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  69. <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>
  70. </div>
  71. </div>
  72. </div>
  73. <h2 class="ui dividing header">Variations</h2>
  74. <div class="example">
  75. <h4 class="ui header">Fluid</h4>
  76. <p>An accordion can take up the width of its container</p>
  77. <div class="ui styled fluid accordion">
  78. <div class="active title">
  79. <i class="dropdown icon"></i>
  80. What is a dog?
  81. </div>
  82. <div class="active content">
  83. <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>
  84. </div>
  85. <div class="title">
  86. <i class="dropdown icon"></i>
  87. What kinds of dogs are there?
  88. </div>
  89. <div class="content">
  90. <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>
  91. </div>
  92. <div class="title">
  93. <i class="dropdown icon"></i>
  94. How do you acquire a dog?
  95. </div>
  96. <div class="content">
  97. <p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
  98. <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>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="ui tab" data-tab="examples">
  104. <h2 class="ui dividing header">Examples</h2>
  105. <div class="example">
  106. <h3 class="ui header">Nested</h3>
  107. <p>An accordion can have multiple levels of nested content. This content can either be in a nested <code>accordion</code> or simply another level of <code>title</code> and <code>content</code></p>
  108. <div class="ui styled accordion">
  109. <div class="active title">
  110. <i class="dropdown icon"></i>
  111. Level 1
  112. </div>
  113. <div class="active content">
  114. Welcome to level 1 where sub content formatted as its own accordion.
  115. <div class="accordion">
  116. <div class="active title">
  117. <i class="dropdown icon"></i>
  118. Level 1A
  119. </div>
  120. <div class="active content">
  121. <p>Level 1A Contents</p>
  122. <div class="accordion">
  123. <div class="title">
  124. <i class="dropdown icon"></i>
  125. Level 1A-A
  126. </div>
  127. <div class="content">
  128. Level 1A-A Contents
  129. </div>
  130. <div class="title">
  131. <i class="dropdown icon"></i>
  132. Level 1A-B
  133. </div>
  134. <div class="content">
  135. Level 1A-B Contents
  136. </div>
  137. </div>
  138. </div>
  139. <div class="title">
  140. <i class="dropdown icon"></i>
  141. Level 1B
  142. </div>
  143. <div class="content">
  144. Level 1B Contents
  145. </div>
  146. <div class="title">
  147. <i class="dropdown icon"></i>
  148. Level 1C
  149. </div>
  150. <div class="content">
  151. Level 1C Contents
  152. </div>
  153. </div>
  154. </div>
  155. <div class="title">
  156. <i class="dropdown icon"></i>
  157. Level 2
  158. </div>
  159. <div class="content">
  160. <p>Welcome to level 2 where content is formatted without nested accordions</p>
  161. <div class="active title">
  162. <i class="dropdown icon"></i>
  163. Level 2A
  164. </div>
  165. <div class="active content">
  166. <p>Level 2A Contents</p>
  167. <div class="title">
  168. <i class="dropdown icon"></i>
  169. Level 2A-A
  170. </div>
  171. <div class="content">
  172. Level 2A-A Contents
  173. </div>
  174. <div class="title">
  175. <i class="dropdown icon"></i>
  176. Level 2A-B
  177. </div>
  178. <div class="content">
  179. Level 2A-B Contents
  180. </div>
  181. </div>
  182. <div class="title">
  183. <i class="dropdown icon"></i>
  184. Level 2B
  185. </div>
  186. <div class="content">
  187. Level 2B Contents
  188. </div>
  189. <div class="title">
  190. <i class="dropdown icon"></i>
  191. Level 2C
  192. </div>
  193. <div class="content">
  194. Level 2C Contents
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="example">
  200. <h3 class="ui header">Form</h3>
  201. <p>An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.</p>
  202. <div class="ui segment">
  203. <div class="ui fluid form">
  204. <div class="two fields">
  205. <div class="field">
  206. <label>First Name</label>
  207. <input placeholder="First Name" type="text">
  208. </div>
  209. <div class="field">
  210. <label>Last Name</label>
  211. <input placeholder="Last Name" type="text">
  212. </div>
  213. </div>
  214. <div class="ui accordion field">
  215. <div class="title">
  216. <i class="icon dropdown"></i>
  217. Optional Details
  218. </div>
  219. <div class="content field">
  220. <label>Maiden Name</label>
  221. <input placeholder="Maiden Name" type="text">
  222. </div>
  223. </div>
  224. <div class="ui secondary submit button">Sign Up</div>
  225. </div>
  226. </div>
  227. </div>
  228. <div class="example">
  229. <h3 class="ui header">Menu</h3>
  230. <p>An accordion can be used to create content drawers inside a menu</p>
  231. <div class="ui vertical accordion menu">
  232. <div class="item">
  233. <a class="active title">
  234. <i class="dropdown icon"></i>
  235. Size
  236. </a>
  237. <div class="active content">
  238. <div class="ui form">
  239. <div class="grouped fields">
  240. <div class="field">
  241. <div class="ui radio checkbox">
  242. <input type="radio" name="size" value="small" />
  243. <label>Small</label>
  244. </div>
  245. </div>
  246. <div class="field">
  247. <div class="ui radio checkbox">
  248. <input type="radio" name="size" value="medium" />
  249. <label>Medium</label>
  250. </div>
  251. </div>
  252. <div class="field">
  253. <div class="ui radio checkbox">
  254. <input type="radio" name="size" value="large" />
  255. <label>Large</label>
  256. </div>
  257. </div>
  258. <div class="field">
  259. <div class="ui radio checkbox">
  260. <input type="radio" name="size" value="x-large" />
  261. <label>X-Large</label>
  262. </div>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. </div>
  268. <div class="item">
  269. <a class="title">
  270. <i class="dropdown icon"></i>
  271. Colors
  272. </a>
  273. <div class="content">
  274. <div class="ui form">
  275. <div class="grouped fields">
  276. <div class="field">
  277. <div class="ui checkbox">
  278. <input type="checkbox" name="small" />
  279. <label>Red</label>
  280. </div>
  281. </div>
  282. <div class="field">
  283. <div class="ui checkbox">
  284. <input type="checkbox" name="medium" />
  285. <label>Orange</label>
  286. </div>
  287. </div>
  288. <div class="field">
  289. <div class="ui checkbox">
  290. <input type="checkbox" name="large" />
  291. <label>Green</label>
  292. </div>
  293. </div>
  294. <div class="field">
  295. <div class="ui checkbox">
  296. <input type="checkbox" name="x-large" />
  297. <label>Blue</label>
  298. </div>
  299. </div>
  300. </div>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. <div class="ui tab" data-tab="usage">
  308. <h2 class="ui dividing header">Initializing</h2>
  309. <h3 class="ui header">Initializing an accordion</h3>
  310. <div class="test code">
  311. $('.ui.accordion')
  312. .accordion()
  313. ;
  314. </div>
  315. <h2 class="ui dividing header">Behaviors</h2>
  316. <p>Behaviors are accessible with javascript using the syntax:<p>
  317. <div class="code">
  318. $('.ui.accordion').accordion('behavior', argumentOne, argumentTwo...);
  319. </div>
  320. <table class="ui definition celled table segment">
  321. <tr>
  322. <td>open (index)</td>
  323. <td>Opens accordion content at index</td>
  324. </tr>
  325. <tr>
  326. <td>close (index)</td>
  327. <td>Closes accordion content at index</td>
  328. </tr>
  329. <tr>
  330. <td>toggle (index)</td>
  331. <td>Toggles accordion content at index</td>
  332. </tr>
  333. </table>
  334. </div>
  335. <div class="ui tab" data-tab="settings">
  336. <h3 class="ui header">
  337. Accordion Settings
  338. <div class="sub header">Accordion settings modify its behavior</div>
  339. </h3>
  340. <table class="ui sortable celled definition table segment">
  341. <thead>
  342. <th>Setting</th>
  343. <th class="four wide">Default</th>
  344. <th>Description</th>
  345. </thead>
  346. <tbody>
  347. <tr>
  348. <td>exclusive</td>
  349. <td>true</td>
  350. <td>Set to false to allow multiple sections to be open at the same time</td>
  351. </tr>
  352. <tr>
  353. <td>collapsible</td>
  354. <td>true</td>
  355. <td>Set to false to require an accordion to always have a section open</td>
  356. </tr>
  357. <tr>
  358. <td>duration</td>
  359. <td>500</td>
  360. <td>Duration in ms of opening animation</td>
  361. </tr>
  362. <tr>
  363. <td>easing</td>
  364. <td>easeInOutQuint</td>
  365. <td>EaseInOutQuint is included with accordion, for additional options consider <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing</a>)</td>
  366. </tr>
  367. </tbody>
  368. </table>
  369. <h3 class="ui header">
  370. Callbacks
  371. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  372. </h3>
  373. <table class="ui sortable celled definition table segment">
  374. <thead>
  375. <th class="four wide">Setting</th>
  376. <th>Context</th>
  377. <th>Description</th>
  378. </thead>
  379. <tbody>
  380. <tr>
  381. <td>onOpen</td>
  382. <td>active content</td>
  383. <td>Callback on element open</td>
  384. </tr>
  385. <tr>
  386. <td>onClose</td>
  387. <td>active content</td>
  388. <td>Callback on element close</td>
  389. </tr>
  390. <tr>
  391. <td>onChange</td>
  392. <td>active content</td>
  393. <td>Callback on element open or close</td>
  394. </tr>
  395. </tbody>
  396. </table>
  397. <h3 class="ui header">
  398. DOM Settings
  399. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  400. </h3>
  401. <table class="ui sortable celled definition table segment">
  402. <thead>
  403. <th>Setting</th>
  404. <th class="six wide">Default</th>
  405. <th>Description</th>
  406. </thead>
  407. <tbody>
  408. <tr>
  409. <td>namespace</td>
  410. <td>accordion</td>
  411. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  412. </tr>
  413. <tr>
  414. <td>selector</td>
  415. <td>
  416. <div class="code" data-type="css">
  417. {
  418. title : '.title',
  419. content : '.content'
  420. }
  421. </div>
  422. </td>
  423. <td>Object containing selectors used by module.</td>
  424. </tr>
  425. <tr>
  426. <td>className</td>
  427. <td>
  428. <div class="code">
  429. className : {
  430. active : 'active'
  431. }
  432. </div>
  433. </td>
  434. <td>Class names used to attach style to state</td>
  435. </tr>
  436. </tbody>
  437. </table>
  438. <h3 class="ui header">
  439. Debug Settings
  440. <div class="sub header">Debug settings controls debug output to the console</div>
  441. </h3>
  442. <table class="ui sortable celled definition table segment">
  443. <thead>
  444. <th>Setting</th>
  445. <th class="four wide">Default</th>
  446. <th>Description</th>
  447. </thead>
  448. <tbody>
  449. <tr>
  450. <td>name</td>
  451. <td>Accordion</td>
  452. <td>Name used in debug logs</td>
  453. </tr>
  454. <tr>
  455. <td>debug</td>
  456. <td>True</td>
  457. <td>Provides standard debug output to console</td>
  458. </tr>
  459. <tr>
  460. <td>performance</td>
  461. <td>True</td>
  462. <td>Provides standard debug output to console</td>
  463. </tr>
  464. <tr>
  465. <td>verbose</td>
  466. <td>True</td>
  467. <td>Provides ancillary debug output to console</td>
  468. </tr>
  469. <tr>
  470. <td>errors</td>
  471. <td colspan="2">
  472. <div class="code">
  473. error : {
  474. method : 'The method you called is not defined.',
  475. notFound : 'There were no elements that matched the specified selector'
  476. }
  477. </div>
  478. </td>
  479. </tr>
  480. </tbody>
  481. </table>
  482. </div>
  483. </div>