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.

614 lines
17 KiB

  1. ---
  2. layout : 'default'
  3. css : 'side'
  4. title : 'Sidebar'
  5. description : 'A sidebar is a menu hidden beside page content'
  6. type : 'UI Module'
  7. ---
  8. <script src="/javascript/sidebar.js"></script>
  9. <%- @partial('header', { tabs: 'module' }) %>
  10. <div class="ui styled sidebar">
  11. <h3 class="ui header">You Might Like</h3>
  12. <div class="ui fluid vertical menu">
  13. <a class="item">
  14. <i class="chat outline icon"></i>
  15. More by this author
  16. </a>
  17. <a class="item">
  18. <i class="text file icon"></i>
  19. Suggested Articles
  20. </a>
  21. </div>
  22. <h3 class="ui header">Contact Us</h3>
  23. <div class="ui form">
  24. <div class="field">
  25. <label>Name</label>
  26. <div class="ui icon input">
  27. <i class="user icon"></i>
  28. <input type="text" data-placeholder="Name">
  29. </div>
  30. </div>
  31. <div class="field">
  32. <label>Message</label>
  33. <textarea></textarea>
  34. </div>
  35. <div class="ui black fluid button">Submit</div>
  36. </div>
  37. </div>
  38. <div class="ui thin styled sidebar">
  39. <h3 class="ui header">Share</h3>
  40. <div class="ui fluid vertical labeled icon buttons">
  41. <div class="ui facebook button">
  42. <i class="facebook icon"></i>
  43. Facebook
  44. </div>
  45. <div class="ui twitter button">
  46. <i class="twitter icon"></i>
  47. Twitter
  48. </div>
  49. <div class="ui google plus button">
  50. <i class="google plus icon"></i>
  51. Google
  52. </div>
  53. </div>
  54. </div>
  55. <div class="ui very thin styled sidebar">
  56. <div class="ui fluid vertical icon buttons">
  57. <div class="ui facebook button">
  58. <i class="facebook icon"></i>
  59. </div>
  60. <div class="ui twitter button">
  61. <i class="twitter icon"></i>
  62. </div>
  63. <div class="ui google plus button">
  64. <i class="google plus icon"></i>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="ui wide styled sidebar">
  69. <h3 class="ui header">You Might Like</h3>
  70. <div class="ui fluid vertical menu">
  71. <a class="item">
  72. <i class="chat outline icon"></i>
  73. More by this author
  74. </a>
  75. <a class="item">
  76. <i class="text file icon"></i>
  77. Suggested Articles
  78. </a>
  79. </div>
  80. </div>
  81. <div class="ui very wide styled sidebar">
  82. <h3 class="ui header">Contact Us</h3>
  83. <div class="ui form">
  84. <div class="field">
  85. <label>Name</label>
  86. <div class="ui icon input">
  87. <i class="user icon"></i>
  88. <input type="text" data-placeholder="Name">
  89. </div>
  90. </div>
  91. <div class="field">
  92. <label>Message</label>
  93. <textarea></textarea>
  94. </div>
  95. <div class="ui black fluid button">Submit</div>
  96. </div>
  97. </div>
  98. <div class="ui vertical overlay sidebar menu">
  99. <a class="item">
  100. <i class="home icon"></i>
  101. Home
  102. </a>
  103. <a class="active item">
  104. <i class="heart icon"></i>
  105. Current Section
  106. </a>
  107. <a class="item">
  108. <i class="facebook icon"></i>
  109. Like us on Facebook
  110. </a>
  111. <div class="item">
  112. <b>More</b>
  113. <div class="menu">
  114. <a class="item">About</a>
  115. <a class="item">Contact Us</a>
  116. </div>
  117. </div>
  118. </div>
  119. <div class="ui floating vertical sidebar menu">
  120. <a class="item">
  121. <i class="home icon"></i>
  122. Home
  123. </a>
  124. <a class="active item">
  125. <i class="heart icon"></i>
  126. Current Section
  127. </a>
  128. <a class="item">
  129. <i class="facebook icon"></i>
  130. Like us on Facebook
  131. </a>
  132. <div class="item">
  133. <b>More</b>
  134. <div class="menu">
  135. <a class="item">About</a>
  136. <a class="item">Contact Us</a>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="ui red vertical demo sidebar menu">
  141. <a class="item">
  142. <i class="home icon"></i>
  143. Home
  144. </a>
  145. <a class="active item">
  146. <i class="heart icon"></i>
  147. Current Section
  148. </a>
  149. <a class="item">
  150. <i class="facebook icon"></i>
  151. Like us on Facebook
  152. </a>
  153. <div class="item">
  154. <b>More</b>
  155. <div class="menu">
  156. <a class="item">About</a>
  157. <a class="item">Contact Us</a>
  158. </div>
  159. </div>
  160. </div>
  161. <div class="ui left sidebar vertical menu">
  162. <div class="header item">Left Sidebar menu</div>
  163. <a class="item">One</a>
  164. <a class="item">Two</a>
  165. <a class="item">Three</a>
  166. </div>
  167. <div class="ui right sidebar inverted red vertical menu">
  168. <div class="header item">Right Sidebar menu</div>
  169. <a class="item">One</a>
  170. <a class="item">Two</a>
  171. <a class="item">Three</a>
  172. </div>
  173. <div class="ui top inverted teal sidebar menu">
  174. <div class="header item">Top Sidebar menu</div>
  175. <a class="item">One</a>
  176. <a class="item">Two</a>
  177. <a class="item">Three</a>
  178. </div>
  179. <div class="ui bottom inverted sidebar menu">
  180. <div class="header item">Bottom Sidebar menu</div>
  181. <a class="item">One</a>
  182. <a class="item">Two</a>
  183. <a class="item">Three</a>
  184. </div>
  185. <div class="main container">
  186. <div class="ui active tab" data-tab="definition">
  187. <div class="peek">
  188. <div class="ui vertical pointing secondary menu">
  189. <a class="active item">Types</a>
  190. <a class="item">Variations</a>
  191. </div>
  192. </div>
  193. <h2 class="ui dividing header">Types</h2>
  194. <div class="no example">
  195. <h4 class="ui header">Direction</h4>
  196. <p>A sidebar can appear on any side of content</p>
  197. <div class="code" data-type="html">
  198. <div class="ui sidebar">...</div>
  199. <div class="ui top sidebar">...</div>
  200. <div class="ui right sidebar">...</div>
  201. <div class="ui bottom sidebar">...</div>
  202. </div>
  203. <div class="ui variation toggle buttons">
  204. <div class="ui button" data-variation=".left">
  205. Left
  206. </div>
  207. <div class="ui button" data-variation=".top">
  208. Top
  209. </div>
  210. <div class="ui button" data-variation=".right">
  211. Right
  212. </div>
  213. <div class="ui button" data-variation=".bottom">
  214. Bottom
  215. </div>
  216. </div>
  217. </div>
  218. <h2 class="ui dividing header">Variations</h2>
  219. <div class="no styled example">
  220. <h4 class="ui header">Styled</h4>
  221. <p>A sidebar can be formatted to include additional styling for display</p>
  222. <div class="code" data-type="html">
  223. <div class="ui styled sidebar">...</div>
  224. </div>
  225. <div class="ui labeled icon button">
  226. <i class="reorder icon"></i>
  227. Show
  228. </div>
  229. </div>
  230. <div class="no size example">
  231. <h4 class="ui header">Size</h4>
  232. <p>A sidebar can vary in width and height to allow more content</p>
  233. <div class="code" data-type="html">
  234. <div class="ui very thin sidebar">...</div>
  235. <div class="ui thin sidebar">...</div>
  236. <div class="ui wide sidebar">...</div>
  237. <div class="ui very wide sidebar">...</div>
  238. </div>
  239. <div class="ui variation toggle buttons">
  240. <div class="ui button" data-variation=".very.thin">
  241. Very Thin
  242. </div>
  243. <div class="ui button" data-variation=".thin">
  244. Thin
  245. </div>
  246. <div class="ui button" data-variation=".wide">
  247. Wide
  248. </div>
  249. <div class="ui button" data-variation=".very.wide">
  250. Very Wide
  251. </div>
  252. </div>
  253. </div>
  254. <div class="no floating example">
  255. <h4 class="ui header">Floating</h4>
  256. <p>A sidebar can appear floating above content</p>
  257. <div class="code" data-type="html">
  258. <div class="ui floating sidebar">...</div>
  259. </div>
  260. <div class="ui labeled icon button">
  261. <i class="reorder icon"></i>
  262. Show
  263. </div>
  264. </div>
  265. </div>
  266. <div class="ui tab" data-tab="usage">
  267. <h2 class="ui dividing header">Initializing</h2>
  268. <p>Any content can be used as a sidebar by adding the class <code>ui sidebar</code> and initializing the menu in javascript.</p>
  269. <div class="ui ignored warning icon message">
  270. <i class="info letter icon"></i>
  271. <div class="content">
  272. <div class="header">Fixed Position</div>
  273. <p>Fixed position content may have issues changing it's position when a sidebar appears. There are two solutions</p>
  274. <ul class="ui list">
  275. <li>Specify your fixed content without using the css left or top properties.</li>
  276. <li>Apply styles on the fixed element to adjust its position when the sidebar appears. You can do this by descending from the body tag which receives the class <code>(direction) pushed</code> when the view is moved.</li>
  277. </ul>
  278. </div>
  279. </div>
  280. <div class="code" data-label="true" data-type="html">
  281. <div class="ui sidebar">
  282. Any content in the world
  283. </div>
  284. </div>
  285. <div class="code" data-label="true" data-type="javascript">
  286. $('.ui.sidebar')
  287. .sidebar()
  288. ;
  289. </div>
  290. <h2 class="ui dividing header">Usage</h2>
  291. <div class="no example">
  292. <h4 class="ui header">Showing a sidebar</h4>
  293. <p>A sidebar can be shown, hidden, or toggled. In the following examples sidebar is used in conjunction with <a href="/collections/menu.html">ui menu</a> to display a vertical menu as a sidebar.</p>
  294. <div class="code" data-type="html" data-title="Example HTML">
  295. <div class="ui red vertical demo sidebar menu">
  296. <a class="item">
  297. <i class="home icon"></i>
  298. Home
  299. </a>
  300. <a class="active item">
  301. <i class="heart icon"></i>
  302. Current Section
  303. </a>
  304. <a class="item">
  305. <i class="facebook icon"></i>
  306. Like us on Facebook
  307. </a>
  308. <div class="item">
  309. <b>More</b>
  310. <div class="menu">
  311. <a class="item">About</a>
  312. <a class="item">Contact Us</a>
  313. </div>
  314. </div>
  315. </div>
  316. </div>
  317. <div class="code" data-demo="true" data-type="javascript">
  318. $('.demo.sidebar')
  319. .sidebar('toggle')
  320. ;
  321. </div>
  322. </div>
  323. <h2 class="ui dividing header">Behavior</h2>
  324. <p>All the following <a href="/module.html#/behavior">behaviors</a> can be called using the syntax:</p>
  325. <div class="code">
  326. $('.your.element')
  327. .dropdown('behavior name', argumentOne, argumentTwo)
  328. ;
  329. </div>
  330. <table class="ui definition celled sortable table segment">
  331. <thead>
  332. <th>Behavior</th>
  333. <th>Description</th>
  334. </thead>
  335. <tbody>
  336. <tr>
  337. <td>attach events(selector, event)</td>
  338. <td>Attaches sidebar action to given selector. Default event if none specified is toggle</td>
  339. </tr>
  340. <tr>
  341. <td>show</td>
  342. <td>Shows sidebar</td>
  343. </tr>
  344. <tr>
  345. <td>hide</td>
  346. <td>Hides sidebar</td>
  347. </tr>
  348. <tr>
  349. <td>toggle</td>
  350. <td>Toggles visibility of sidebar</td>
  351. </tr>
  352. <tr>
  353. <td>is open</td>
  354. <td>Returns whether sidebar is open</td>
  355. </tr>
  356. <tr>
  357. <td>is closed</td>
  358. <td>Returns whether sidebar is closed</td>
  359. </tr>
  360. <tr>
  361. <td>push page</td>
  362. <td>Pushes page content to be visible alongside sidebar</td>
  363. </tr>
  364. <tr>
  365. <td>get direction</td>
  366. <td>Returns direction of current sidebar</td>
  367. </tr>
  368. <tr>
  369. <td>pull page</td>
  370. <td>Returns page content to original position</td>
  371. </tr>
  372. <tr>
  373. <td>add body css</td>
  374. <td>Adds stylesheet to page head to trigger sidebar animations</td>
  375. </tr>
  376. <tr>
  377. <td>remove body css</td>
  378. <td>Removes any inline stylesheets for sidebar animation</td>
  379. </tr>
  380. <tr>
  381. <td>get transition event</td>
  382. <td>Returns vendor prefixed transition end event</td>
  383. </tr>
  384. </tbody>
  385. </table>
  386. </div>
  387. <div class="ui tab" data-tab="examples">
  388. <div class="no example">
  389. <h4 class="ui header">Overlay</h4>
  390. <p>A sidebar can overlay page content instead of pushing it to the side</p>
  391. <div class="code" data-demo="true">
  392. $('.overlay.sidebar')
  393. .sidebar({
  394. overlay: true
  395. })
  396. .sidebar('toggle')
  397. ;
  398. </div>
  399. </div>
  400. <div class="no example">
  401. <h4 class="ui header">Triggering show/hide with other content</h4>
  402. <p>For convenience calling attach events will allow you to bind events. By default this will toggle the sidebar in and out of view on click</p>
  403. <div class="code" data-demo="true">
  404. $('.demo.sidebar').first()
  405. .sidebar('attach events', '.toggle.button')
  406. ;
  407. $('.toggle.button')
  408. .removeClass('disabled')
  409. ;
  410. </div>
  411. <div class="ui disabled secondary labeled icon toggle button">
  412. <i class="reorder icon"></i>
  413. Trigger Sidebar
  414. </div>
  415. </div>
  416. <div class="no example">
  417. <h4 class="ui header">Triggering custom action with other content</h4>
  418. <p>You can also however specify what action should occur when the element is clicked</p>
  419. <div class="code" data-demo="true">
  420. $('.demo.sidebar').first()
  421. .sidebar('attach events', '.open.button', 'show')
  422. ;
  423. $('.open.button')
  424. .removeClass('disabled')
  425. ;
  426. </div>
  427. <div class="ui disabled secondary labeled icon open button">
  428. <i class="reorder icon"></i>
  429. Open Sidebar
  430. </div>
  431. </div>
  432. </div>
  433. <div class="ui tab" data-tab="settings">
  434. <h3 class="ui header">
  435. Sidebar Settings
  436. <div class="sub header">Form settings modify the sidebar behavior</div>
  437. </h3>
  438. <table class="ui celled sortable definition table segment">
  439. <thead>
  440. <th>Setting</th>
  441. <th class="four wide">Default</th>
  442. <th>Description</th>
  443. </thead>
  444. <tbody>
  445. <tr>
  446. <td>overlay</td>
  447. <td>false</td>
  448. <td>Whether sidebar should overlay page instead of pushing page to the side</td>
  449. </tr>
  450. <tr>
  451. <td>exclusive</td>
  452. <td>true</td>
  453. <td>Whether multiple sidebars can be open at once</td>
  454. </tr>
  455. <tr>
  456. <td>useCSS</td>
  457. <td>true</td>
  458. <td>Whether to use css animations or fallback javascript animations</td>
  459. </tr>
  460. <tr>
  461. <td>duration</td>
  462. <td>300</td>
  463. <td>Duration of side bar transition animation</td>
  464. </tr>
  465. </tbody>
  466. </table>
  467. <div class="ui horizontal section icon divider"><i class="icon setting"></i></div>
  468. <h4 class="ui header">Callbacks</h4>
  469. <p>Callbacks specify a function to occur after a specific behavior.</p>
  470. <table class="ui celled sortable definition table segment">
  471. <thead>
  472. <th class="four wide">Setting</th>
  473. <th>Context</th>
  474. <th>Description</th>
  475. </thead>
  476. <tbody>
  477. <tr>
  478. <td>onShow</td>
  479. <td>Sidebar</td>
  480. <td>Is called when a sidebar is shown.</td>
  481. </tr>
  482. <tr>
  483. <td>onHide</td>
  484. <td>Sidebar</td>
  485. <td>Is called when a sidebar is hidden.</td>
  486. </tr>
  487. <tr>
  488. <td>onChange</td>
  489. <td>Sidebar</td>
  490. <td>Is called after a sidebar changes visibility</td>
  491. </tr>
  492. </tbody>
  493. </table>
  494. <div class="ui horizontal divider"><i class="icon setting"></i></div>
  495. <h3 class="ui header">
  496. DOM Settings
  497. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  498. </h3>
  499. <table class="ui celled definition table segment">
  500. <thead>
  501. <th>Setting</th>
  502. <th class="six wide">Default</th>
  503. <th>Description</th>
  504. </thead>
  505. <tbody>
  506. <tr>
  507. <td>namespace</td>
  508. <td>sidebar</td>
  509. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  510. </tr>
  511. <tr>
  512. <td>className</td>
  513. <td>
  514. <div class="code">
  515. className: {
  516. active : 'active',
  517. pushed : 'pushed',
  518. top : 'top',
  519. left : 'left',
  520. right : 'right',
  521. bottom : 'bottom'
  522. }
  523. </div>
  524. </td>
  525. <td>Class names used to attach style to state</td>
  526. </tr>
  527. </tbody>
  528. </table>
  529. <div class="ui horizontal divider"><i class="icon setting"></i></div>
  530. <h3 class="ui header">
  531. Debug Settings
  532. <div class="sub header">Debug settings controls debug output to the console</div>
  533. </h3>
  534. <table class="ui celled sortable definition table segment">
  535. <thead>
  536. <th>Setting</th>
  537. <th class="four wide">Default</th>
  538. <th>Description</th>
  539. </thead>
  540. <tbody>
  541. <tr>
  542. <td>name</td>
  543. <td>Sidebar</td>
  544. <td>Name used in debug logs</td>
  545. </tr>
  546. <tr>
  547. <td>debug</td>
  548. <td>True</td>
  549. <td>Provides standard debug output to console</td>
  550. </tr>
  551. <tr>
  552. <td>performance</td>
  553. <td>True</td>
  554. <td>Provides standard debug output to console</td>
  555. </tr>
  556. <tr>
  557. <td>verbose</td>
  558. <td>True</td>
  559. <td>Provides ancillary debug output to console</td>
  560. </tr>
  561. <tr>
  562. <td>errors</td>
  563. <td colspan="2">
  564. <div class="code">
  565. error : {
  566. method : 'The method you called is not defined.',
  567. notFound : 'There were no elements that matched the specified selector'
  568. }
  569. </div>
  570. </td>
  571. </tr>
  572. </tbody>
  573. </table>
  574. </div>
  575. </div>
  576. </body>
  577. </html>