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.

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