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.

945 lines
31 KiB

  1. ---
  2. layout : 'default'
  3. css : 'dropdown'
  4. title : 'Dropdown'
  5. description : 'A dropdown allows a user to select a value from a series of options'
  6. type : 'UI Module'
  7. element : 'dropdown'
  8. elementType : 'module'
  9. themes : ['Default']
  10. ---
  11. <link rel="stylesheet/less" type="text/css" href="/build/less/definitions/modules/dropdown.less" />
  12. <script src="/javascript/dropdown.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. <a class="item">States</a>
  21. </div>
  22. </div>
  23. <h2 class="ui dividing header">Types</h2>
  24. <div class="dropdown example">
  25. <h4 class="ui header">Dropdown</h4>
  26. <p>A basic dropdown has no special formatting of its own</p>
  27. <div class="ui dropdown">
  28. <div class="text">Select</div>
  29. <i class="dropdown icon"></i>
  30. <div class="menu">
  31. <div class="item">Edit</div>
  32. <div class="item">Remove</div>
  33. <div class="item">Hide</div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="dropdown example">
  38. <h4 class="ui header">Inline</h4>
  39. <p>A dropdown can be formatted to appear inline in other content</p>
  40. <div>Show me posts trending
  41. <div class="ui inline dropdown">
  42. <div class="text">today</div>
  43. <i class="dropdown icon"></i>
  44. <div class="menu">
  45. <div class="item" data-text="today">Today</div>
  46. <div class="item" data-text="this week">This Week</div>
  47. <div class="item" data-text="this month">This Month</div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="dropdown example">
  53. <h4 class="ui header">Selection</h4>
  54. <p>A dropdown can point to other content to show its relationship</p>
  55. <div class="ui selection dropdown">
  56. <input type="hidden" name="gender">
  57. <div class="default text">Gender</div>
  58. <i class="dropdown icon"></i>
  59. <div class="menu">
  60. <div class="item" data-value="1">Male</div>
  61. <div class="item" data-value="0">Female</div>
  62. <div class="item" data-value="2">Unknown</div>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="another dropdown example">
  67. <div class="ui selection dropdown">
  68. <input type="hidden" name="state">
  69. <div class="default text">State</div>
  70. <i class="dropdown icon"></i>
  71. <div class="menu">
  72. <div class="item" value="AL">Alabama</div>
  73. <div class="item" value="AK">Alaska</div>
  74. <div class="item" value="AZ">Arizona</div>
  75. <div class="item" value="AR">Arkansas</div>
  76. <div class="item" value="CA">California</div>
  77. <div class="item" value="CO">Colorado</div>
  78. <div class="item" value="CT">Connecticut</div>
  79. <div class="item" value="DE">Delaware</div>
  80. <div class="item" value="DC">District Of Columbia</div>
  81. <div class="item" value="FL">Florida</div>
  82. <div class="item" value="GA">Georgia</div>
  83. <div class="item" value="HI">Hawaii</div>
  84. <div class="item" value="ID">Idaho</div>
  85. <div class="item" value="IL">Illinois</div>
  86. <div class="item" value="IN">Indiana</div>
  87. <div class="item" value="IA">Iowa</div>
  88. <div class="item" value="KS">Kansas</div>
  89. <div class="item" value="KY">Kentucky</div>
  90. <div class="item" value="LA">Louisiana</div>
  91. <div class="item" value="ME">Maine</div>
  92. <div class="item" value="MD">Maryland</div>
  93. <div class="item" value="MA">Massachusetts</div>
  94. <div class="item" value="MI">Michigan</div>
  95. <div class="item" value="MN">Minnesota</div>
  96. <div class="item" value="MS">Mississippi</div>
  97. <div class="item" value="MO">Missouri</div>
  98. <div class="item" value="MT">Montana</div>
  99. <div class="item" value="NE">Nebraska</div>
  100. <div class="item" value="NV">Nevada</div>
  101. <div class="item" value="NH">New Hampshire</div>
  102. <div class="item" value="NJ">New Jersey</div>
  103. <div class="item" value="NM">New Mexico</div>
  104. <div class="item" value="NY">New York</div>
  105. <div class="item" value="NC">North Carolina</div>
  106. <div class="item" value="ND">North Dakota</div>
  107. <div class="item" value="OH">Ohio</div>
  108. <div class="item" value="OK">Oklahoma</div>
  109. <div class="item" value="OR">Oregon</div>
  110. <div class="item" value="PA">Pennsylvania</div>
  111. <div class="item" value="RI">Rhode Island</div>
  112. <div class="item" value="SC">South Carolina</div>
  113. <div class="item" value="SD">South Dakota</div>
  114. <div class="item" value="TN">Tennessee</div>
  115. <div class="item" value="TX">Texas</div>
  116. <div class="item" value="UT">Utah</div>
  117. <div class="item" value="VT">Vermont</div>
  118. <div class="item" value="VA">Virginia</div>
  119. <div class="item" value="WA">Washington</div>
  120. <div class="item" value="WV">West Virginia</div>
  121. <div class="item" value="WI">Wisconsin</div>
  122. <div class="item" value="WY">Wyoming</div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="button example">
  127. <h4 class="ui header">Floating</h4>
  128. <p>A dropdown menu can appear to be floating below an element.</p>
  129. <div class="ui teal buttons">
  130. <div class="ui button">Save</div>
  131. <div class="ui floating dropdown icon button">
  132. <i class="dropdown icon"></i>
  133. <div class="menu">
  134. <div class="item"><i class="edit icon"></i> Edit Post</div>
  135. <div class="item"><i class="delete icon"></i> Remove Post</div>
  136. <div class="item"><i class="hide icon"></i> Hide Post</div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <div class="hover example">
  142. <h4 class="ui header">Pointing</h4>
  143. <p>A dropdown can be formatted so that its menu is pointing</p>
  144. <div class="ui menu">
  145. <div class="menu">
  146. <a class="active item">
  147. Home
  148. </a>
  149. <div class="ui pointing dropdown link item">
  150. <i class="dropdown icon"></i>
  151. Messages
  152. <div class="menu">
  153. <a class="item"><i class="mail icon"></i>Inbox</a>
  154. <a class="item"><i class="book icon"></i>Archive</a>
  155. </div>
  156. </div>
  157. <a class="item">
  158. Browse
  159. </a>
  160. <a class="item">
  161. Help
  162. </a>
  163. </div>
  164. </div>
  165. </div>
  166. <div class="another hover example">
  167. <div class="ui vertical menu">
  168. <div class="menu">
  169. <a class="active item">
  170. Home
  171. </a>
  172. <div class="ui left pointing dropdown link item">
  173. <i class="dropdown icon"></i>
  174. Messages
  175. <div class="menu">
  176. <a class="item"><i class="mail icon"></i>Inbox</a>
  177. <a class="item"><i class="book icon"></i>Archive</a>
  178. </div>
  179. </div>
  180. <a class="item">
  181. Browse
  182. </a>
  183. <a class="item">
  184. Help
  185. </a>
  186. </div>
  187. </div>
  188. </div>
  189. <div class="another button example">
  190. <div class="ui blue labeled icon top left pointing dropdown button">
  191. <i class="settings icon"></i>
  192. <span class="text">Settings</span>
  193. <div class="menu">
  194. <div class="item"><i class="edit icon"></i> Edit</div>
  195. <div class="item"><i class="delete icon"></i> Remove</div>
  196. <div class="item"><i class="hide icon"></i> Hide</div>
  197. </div>
  198. </div>
  199. <div class="ui red labeled icon top right pointing dropdown button">
  200. <i class="settings icon"></i>
  201. <span class="text">Settings</span>
  202. <div class="menu">
  203. <div class="item"><i class="edit icon"></i> Edit</div>
  204. <div class="item"><i class="delete icon"></i> Remove</div>
  205. <div class="item"><i class="hide icon"></i> Hide</div>
  206. </div>
  207. </div>
  208. </div>
  209. <div class="another button example">
  210. <div class="ui right pointing dropdown icon button">
  211. <i class="settings icon"></i>
  212. <div class="menu">
  213. <div class="item"><i class="edit icon"></i> Edit</div>
  214. <div class="item"><i class="delete icon"></i> Remove</div>
  215. <div class="item"><i class="hide icon"></i> Hide</div>
  216. </div>
  217. </div>
  218. <div class="ui left pointing dropdown icon button">
  219. <i class="settings icon"></i>
  220. <div class="menu">
  221. <div class="item"><i class="edit icon"></i> Edit</div>
  222. <div class="item"><i class="delete icon"></i> Remove</div>
  223. <div class="item"><i class="hide icon"></i> Hide</div>
  224. </div>
  225. </div>
  226. </div>
  227. <div class="example">
  228. <h4 class="ui header">Simple</h4>
  229. <p>A simple dropdown can open without javascript</p>
  230. <div class="ui compact menu">
  231. <div class="ui simple dropdown item">
  232. <i class="dropdown icon"></i>
  233. Dropdown
  234. <div class="menu">
  235. <div class="item">Choice 1</div>
  236. <div class="item">Choice 2</div>
  237. <div class="item">Choice 3</div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. <h2 class="ui dividing header">Variations</h2>
  243. <div class="dropdown example">
  244. <h4 class="ui header">Fluid</h4>
  245. <p>A dropdown can take the full width of its parent</p>
  246. <div class="ui vertical menu">
  247. <a class="item">Link 1</a>
  248. <a class="item">Link 2</a>
  249. <div class="header item">All Sections</div>
  250. <div class="ui item">
  251. <div class="ui fluid selection dropdown">
  252. <div class="text">More</div>
  253. <i class="dropdown icon"></i>
  254. <div class="menu">
  255. <div class="item">Choice 1</div>
  256. <div class="item">Choice 2</div>
  257. <div class="item">Choice 3</div>
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. </div>
  263. <h2 class="ui dividing header">States</h2>
  264. <div class="dropdown example">
  265. <h4 class="ui header">Error</h4>
  266. <p>An errored dropddown can alert a user to a problem</p>
  267. <div class="ui floating dropdown error">
  268. Dropdown <i class="dropdown icon"></i>
  269. <div class="menu">
  270. <div class="item">Choice 1</div>
  271. <div class="item">Choice 2</div>
  272. <div class="item">Choice 3</div>
  273. </div>
  274. </div>
  275. <br><br>
  276. <div class="ui selection dropdown error">
  277. Dropdown <i class="dropdown icon"></i>
  278. <div class="menu">
  279. <div class="item">Choice 1</div>
  280. <div class="item">Choice 2</div>
  281. <div class="item">Choice 3</div>
  282. </div>
  283. </div>
  284. </div>
  285. <h4 class="ui header">Simple Dropdown (No Javascript)</h4>
  286. <div class="example">
  287. <h4 class="ui header">Active</h4>
  288. <p>An active dropdown has its menu open</p>
  289. <div class="ui info message">An active state will only affect a simple dropdown. To activate a menu on a dropdown module use <code>$('.ui.dropdown').dropdown('show');</code></div>
  290. <div class="ui simple active dropdown">
  291. Dropdown <i class="dropdown icon"></i>
  292. <div class="menu">
  293. <div class="item">Choice 1</div>
  294. <div class="item">Choice 2</div>
  295. </div>
  296. </div>
  297. </div>
  298. <div class="example">
  299. <h4 class="ui header">Disabled</h4>
  300. <p>A disabled dropdown menu will not open or close</p>
  301. <div class="ui info message">A disabled state will only affect a simple dropdown. To disable a dropdown module use <code>$('.ui.dropdown').dropdown('destroy');</code></div>
  302. <div class="ui simple disabled dropdown">
  303. Dropdown <i class="dropdown icon"></i>
  304. <div class="menu">
  305. <div class="item">Choice 1</div>
  306. <div class="item">Choice 2</div>
  307. <div class="item">Choice 3</div>
  308. </div>
  309. </div>
  310. </div>
  311. </div>
  312. <div class="ui tab" data-tab="usage">
  313. <h2 class="ui dividing header">Initializing</h2>
  314. <h3 class="ui header">Initializing a dropdown</h3>
  315. <div class="code" data-label="HTML" data-type="html">
  316. <div class="ui dropdown">
  317. <div class="text">Select</div>
  318. <i class="dropdown icon"></i>
  319. <div class="menu">
  320. <div class="item" data-value="option1">Option 1</div>
  321. <div class="item" data-value="option2">Option 2</div>
  322. </div>
  323. </div>
  324. </div>
  325. <div class="code" data-label="Javascript" data-type="javascript">
  326. $('.ui.dropdown')
  327. .dropdown()
  328. ;
  329. </div>
  330. <h2 class="ui dividing header">Behavior</h2>
  331. <p>All the following <a href="/module.html#/behavior">behaviors</a> can be called using the syntax:</p>
  332. <div class="code">
  333. $('.your.element')
  334. .dropdown('behavior name', argumentOne, argumentTwo)
  335. ;
  336. </div>
  337. <table class="ui definition sortable celled table segment">
  338. <thead>
  339. <tr>
  340. <th>Behavior</th>
  341. <th>Description</th>
  342. </tr>
  343. </thead>
  344. <tbody>
  345. <tr>
  346. <td>toggle</td>
  347. <td>Toggles current visibility of dropdown</td>
  348. </tr>
  349. <tr>
  350. <td>show</td>
  351. <td>Shows dropdown</td>
  352. </tr>
  353. <tr>
  354. <td>hide</td>
  355. <td>Hides dropdown</td>
  356. </tr>
  357. <tr>
  358. <td>hide others</td>
  359. <td>Hides all other dropdowns that is not current dropdown</td>
  360. </tr>
  361. <tr>
  362. <td>restore defaults</td>
  363. <td>Restores dropdown text and value to its value on page load</td>
  364. </tr>
  365. <tr>
  366. <td>restore default text</td>
  367. <td>Restores dropdown text to its value on page load</td>
  368. </tr>
  369. <tr>
  370. <td>restore default value</td>
  371. <td>Restores dropdown value to its value on page load</td>
  372. </tr>
  373. <tr>
  374. <td>save defaults</td>
  375. <td>Saves current text and value as new defaults (for use with restore)</td>
  376. </tr>
  377. <tr>
  378. <td>set selected(value)</td>
  379. <td>Sets selected state to a given value</td>
  380. </tr>
  381. <tr>
  382. <td>set text(text)</td>
  383. <td>Sets dropdown text to a value</td>
  384. </tr>
  385. <tr>
  386. <td>set value(value)</td>
  387. <td>Sets dropdown input to value</td>
  388. </tr>
  389. <tr>
  390. <td>get text</td>
  391. <td>Returns current dropdown text</td>
  392. </tr>
  393. <tr>
  394. <td>get value</td>
  395. <td>Returns current dropdown input value</td>
  396. </tr>
  397. <tr>
  398. <td>get item(value)</td>
  399. <td>Returns DOM element that matches a given input value</td>
  400. </tr>
  401. <tr>
  402. <td>bind touch events</td>
  403. <td>Adds touch events to element</td>
  404. </tr>
  405. <tr>
  406. <td>mouse events</td>
  407. <td>Adds mouse events to element</td>
  408. </tr>
  409. <tr>
  410. <td>bind intent</td>
  411. <td>Binds a click to document to determine if you click away from a dropdown</td>
  412. </tr>
  413. <tr>
  414. <td>unbind intent</td>
  415. <td>Unbinds document intent click</td>
  416. </tr>
  417. <tr>
  418. <td>determine intent</td>
  419. <td>Returns whether event occurred inside dropdown</td>
  420. </tr>
  421. <tr>
  422. <td>determine select action(text, value)</td>
  423. <td>Triggers preset item selection action based on settings passing text/value</td>
  424. </tr>
  425. <tr>
  426. <td>set active</td>
  427. <td>Sets dropdown to active state
  428. <tr>
  429. <td>set visible</td>
  430. <td>Sets dropdown to visible state</td>
  431. </tr>
  432. <tr>
  433. <td>remove active</td>
  434. <td>rRemoves dropdown active state
  435. <tr>
  436. <td>remove visible</td>
  437. <td>Removes dropdown visible state</td>
  438. </tr>
  439. <tr>
  440. <td>is selection</td>
  441. <td>Returns whether dropdown is a selection dropdown</td>
  442. </tr>
  443. <tr>
  444. <td>is animated</td>
  445. <td>Returns whether dropdown is animated</td>
  446. </tr>
  447. <tr>
  448. <td>is visible</td>
  449. <td>Returns whether dropdown is visible</td>
  450. </tr>
  451. <tr>
  452. <td>is hidden</td>
  453. <td>Returns whether dropdown is hidden</td>
  454. </tr>
  455. </tbody>
  456. </table>
  457. </div>
  458. <div class="ui tab" data-tab="examples">
  459. <div class="transition example">
  460. <h3 class="ui header">Changing Transitions</h3>
  461. <p>A dropdown can specify a different <a href="/modules/transition.html">transitions</a>.</p>
  462. <div class="code" data-type="javascript">
  463. $('.dropdown')
  464. .dropdown({
  465. // you can use any ui transition
  466. transition: 'drop'
  467. })
  468. ;
  469. </div>
  470. <div class="ui teal buttons">
  471. <div class="ui button">Toggle</div>
  472. <div class="ui floating dropdown icon button">
  473. <i class="dropdown icon"></i>
  474. <div class="menu">
  475. <div class="item" data-value="drop">Drop</div>
  476. <div class="item" data-value="horizontal flip">Horizontal Flip</div>
  477. <div class="item" data-value="fade up">Fade Up</div>
  478. <div class="item" data-value="scale">Scale</div>
  479. </div>
  480. </div>
  481. </div>
  482. </div>
  483. <div class="dropdown example">
  484. <h3 class="ui header">Multiple Levels</h3>
  485. <p>A dropdown menu can also contain sub menus inside of it</p>
  486. My favorite animal breed is <div class="ui inline dropdown">
  487. <input type="hidden" name="gender">
  488. <div class="text">Shiba Inu</div>
  489. <i class="dropdown icon"></i>
  490. <div class="menu">
  491. <div class="item">
  492. <i class="dropdown icon"></i>
  493. Dogs
  494. <div class="menu">
  495. <div class="item">Shiba Inu</div>
  496. <div class="item">Poodle</div>
  497. <div class="item">Labrador</div>
  498. </div>
  499. </div>
  500. <div class="item">
  501. <i class="dropdown icon"></i>
  502. Cats
  503. <div class="menu">
  504. <div class="item">Aegean</div>
  505. <div class="item">Balinese</div>
  506. <div class="item">Persian</div>
  507. </div>
  508. </div>
  509. </div>
  510. </div>
  511. </div>
  512. <div class="dropdown example">
  513. <h3 class="ui header">Preserving User Selections</h3>
  514. <p>This example uses a preset text value to preserve the menu item on page navigation</p>
  515. <div class="ui ignored info icon message">
  516. <i class="help circle icon"></i>
  517. <div class="content">
  518. <p>A dropdown will automatically select on page load any menu item that includes the currently value of <code>text</code> or your dropdown's <code>hidden input</code> value.</p>
  519. <p>This is used to preserve a user's selection on page navigation and will automatically remove and default text placeholder formatting.</p>
  520. </div>
  521. </div>
  522. Current action: <div class="ui inline dropdown">
  523. <div class="text">Hide</div>
  524. <i class="dropdown icon"></i>
  525. <div class="menu">
  526. <div class="item">Edit</div>
  527. <div class="item">Remove</div>
  528. <div class="item">Hide</div>
  529. </div>
  530. </div>
  531. </div>
  532. <div class="dropdown example">
  533. <h3 class="ui header">Button Group</h3>
  534. <p>A <a href="/elements/button.html">button group</a> can be formatted to show additional content as a dropdown</p>
  535. <div class="ui icon buttons">
  536. <div class="ui top left pointing dropdown button">
  537. <i class="user icon"></i>
  538. <div class="menu">
  539. <div class="item"><i class="edit icon"></i>Edit User</div>
  540. <div class="item"><i class="delete icon"></i>Remove User</div>
  541. <div class="item"><i class="hide icon"></i>Make Invisible</div>
  542. </div>
  543. </div>
  544. <div class="ui top left pointing dropdown button">
  545. <i class="users icon"></i>
  546. <div class="menu">
  547. <div class="item"><i class="edit icon"></i>Edit Group</div>
  548. <div class="item"><i class="delete icon"></i>Remove Group</div>
  549. <div class="item"><i class="hide icon"></i>Hide from Group</div>
  550. </div>
  551. </div>
  552. <div class="ui top right pointing dropdown button">
  553. <i class="settings icon"></i>
  554. <div class="menu">
  555. <div class="item"><i class="edit icon"></i> Edit</div>
  556. <div class="item"><i class="delete icon"></i> Remove</div>
  557. <div class="item"><i class="hide icon"></i> Hide</div>
  558. </div>
  559. </div>
  560. </div>
  561. </div>
  562. <div class="hover example">
  563. <h3 class="ui header">Menu</h3>
  564. <p>A <a href="/collections/menu.html">menu</a> element can contain a dropdown</p>
  565. <div class="ui tiered purple inverted menu">
  566. <div class="menu">
  567. <a class="active item">
  568. Home
  569. </a>
  570. <a class="ui dropdown item">
  571. <i class="dropdown icon"></i>Messages
  572. <div class="menu">
  573. <div class="item">
  574. <i class="dropdown icon"></i>
  575. Categories
  576. <div class="menu">
  577. <div class="item">Unread</div>
  578. <div class="item">Promotions</div>
  579. <div class="item">Updates</div>
  580. </div>
  581. </div>
  582. <div class="item">Archive</div>
  583. </div>
  584. </a>
  585. <a class="item">
  586. Browse
  587. </a>
  588. </div>
  589. <div class="sub menu">
  590. <a class="item">Activity Feed</a>
  591. <a class="item">Profile</a>
  592. <a class="item">Events</a>
  593. </div>
  594. </div>
  595. </div>
  596. <div class="dropdown example">
  597. <h3 class="ui header">Form</h3>
  598. <p>A dropdown can be formatted to allow selection inside a <a href="/collections/form.html">form</a></p>
  599. <div class="ui form segment">
  600. <p>Let's go ahead and get you signed up.</p>
  601. <div class="two fields">
  602. <div class="field">
  603. <label>First Name</label>
  604. <input placeholder="First Name" type="text">
  605. </div>
  606. <div class="field">
  607. <label>Last Name</label>
  608. <input placeholder="Last Name" type="text">
  609. </div>
  610. </div>
  611. <div class="field">
  612. <label>Gender</label>
  613. <div class="ui dropdown selection">
  614. <input type="hidden" name="gender">
  615. <div class="default text">...</div>
  616. <i class="dropdown icon"></i>
  617. <div class="menu">
  618. <div class="item" data-value="male">Male</div>
  619. <div class="item" data-value="female">Female</div>
  620. </div>
  621. </div>
  622. </div>
  623. </div>
  624. </div>
  625. <h3 class="ui dividing header">Using Different Dropdown Actions</h3>
  626. <div class="button example">
  627. <h4 class="ui header">Combo Dropdowns</h4>
  628. <div class="ignored">
  629. <p>A <a href="/elements/button.html">button</a> can be formatted with a dropdown.</p>
  630. <p>You can change the default action that occurs on selection to different presets built into <em>ui dropdown</em>.</p>
  631. <p>For example, using the <code>combo</code> preset will change the preceding buttons text value to the current selected alue</p>
  632. <div class="evaluated code" data-type="javascript">
  633. $('.combo.dropdown')
  634. .dropdown({
  635. action: 'combo'
  636. })
  637. ;
  638. </div>
  639. <div class="ui teal buttons">
  640. <div class="ui button">Save</div>
  641. <div class="ui combo dropdown icon button">
  642. <i class="dropdown icon"></i>
  643. <div class="menu">
  644. <div class="item"><i class="edit icon"></i> Edit</div>
  645. <div class="item"><i class="delete icon"></i> Delete</div>
  646. <div class="item"><i class="hide icon"></i> Hide</div>
  647. </div>
  648. </div>
  649. </div>
  650. </div>
  651. <div class="button example">
  652. <h4 class="ui header">Link Dropdowns</h4>
  653. <div class="ignored">
  654. <p>If each option in your dropdown links out to another page, you might just want to make your menu hide without changing any value.</p>
  655. <div class="evaluated code" data-type="javascript">
  656. $('.link.dropdown')
  657. .dropdown({
  658. action: 'hide'
  659. })
  660. ;
  661. </div>
  662. <div class="ui link dropdown icon button">
  663. <div class="text">Go to</div>
  664. <i class="dropdown icon"></i>
  665. <div class="menu">
  666. <a class="item" href="#link1"><i class="home icon"></i> Home</a>
  667. <a class="item" href="#link2"><i class="users icon"></i> Browse</a>
  668. <a class="item" href="#link3"><i class="search icon"></i> Search</a>
  669. </div>
  670. </div>
  671. </div>
  672. </div>
  673. <div class="ui tab" data-tab="settings">
  674. <h3 class="ui header">
  675. Dropdown Settings
  676. <div class="sub header">Dropdown settings modify the dropdown's behavior</div>
  677. </h3>
  678. <table class="ui celled sortable definition table segment">
  679. <thead>
  680. <tr>
  681. <th>Setting</th>
  682. <th class="four wide">Default</th>
  683. <th>Description</th>
  684. </tr>
  685. </thead>
  686. <tbody>
  687. <tr>
  688. <td>on</td>
  689. <td>click</td>
  690. <td>Event used to trigger dropdown (Hover, Click)</td>
  691. </tr>
  692. <tr>
  693. <td>delay</td>
  694. <td>
  695. <div class="code">
  696. delay: {
  697. show: 50,
  698. hide: 300
  699. }
  700. </div>
  701. </td>
  702. <td>Time in milliseconds to debounce show or hide behavior when <code>on: hover</code> is used.</td>
  703. </tr>
  704. <tr>
  705. <td>transition</td>
  706. <td>
  707. slide down
  708. </td>
  709. <td>Named transition to use when animating menu in and out. Fade and slide down are available without including <a href="/modules/transition.html">ui transitions</a></td>
  710. </tr>
  711. <tr>
  712. <td>duration</td>
  713. <td>
  714. 250
  715. </td>
  716. <td>Duration of animation events</td>
  717. </tr>
  718. <tr>
  719. <td>action</td>
  720. <td>auto</td>
  721. <td>Sets a default action to occur.
  722. <div class="ui vertical divided list">
  723. <div class="item">
  724. <div class="header">activate</div>
  725. <div class="description">Most likely action will be determined by type of dropdown, for example a selection dropdown will automatically use updateForm</div>
  726. </div>
  727. <div class="item">
  728. <div class="header">combo</div>
  729. <div class="description">changes text of previous element matching text selector</div>
  730. </div>
  731. <div class="item">
  732. <div class="header">select</div>
  733. <div class="description">activates menu item but does not change text</div>
  734. </div>
  735. <div class="item">
  736. <div class="header">nothing</div>
  737. <div class="description">no action occurs</div>
  738. </div>
  739. <div class="item">
  740. <div class="header">hide</div>
  741. <div class="description">Dropdown menu is hidden</div>
  742. </div>
  743. <div class="item">
  744. <div class="header">function(){}</div>
  745. <div class="description">custom function is executed</div>
  746. </div>
  747. </div>
  748. </tr>
  749. </tbody>
  750. </table>
  751. <div class="ui horizontal section divider"><i class="icon setting"></i></div>
  752. <h3 class="ui header">
  753. Callbacks
  754. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  755. </h3>
  756. <table class="ui celled sortable definition table segment">
  757. <thead>
  758. <tr>
  759. <th class="four wide">Setting</th>
  760. <th>Context</th>
  761. <th>Description</th>
  762. </tr>
  763. </thead>
  764. <tbody>
  765. <tr>
  766. <td>onChange(value, text)</td>
  767. <td>Dropdown</td>
  768. <td>Is called after a dropdown item is selected. receives the name and value of selection.</td>
  769. </tr>
  770. <tr>
  771. <td>onShow</td>
  772. <td>Dropdown</td>
  773. <td>Is called after a dropdown is shown.</td>
  774. </tr>
  775. <tr>
  776. <td>onHide</td>
  777. <td>Dropdown</td>
  778. <td>Is called after a dropdown is hidden.</td>
  779. </tr>
  780. </tbody>
  781. </table>
  782. <h3 class="ui header">
  783. DOM Settings
  784. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  785. </h3>
  786. <table class="ui celled sortable definition table segment">
  787. <thead>
  788. <tr>
  789. <th>Setting</th>
  790. <th class="four wide">Default</th>
  791. <th>Description</th>
  792. </tr>
  793. </thead>
  794. <tbody>
  795. <tr>
  796. <td>namespace</td>
  797. <td>dropdown</td>
  798. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  799. </tr>
  800. <tr>
  801. <td>selector</td>
  802. <td colspan="2">
  803. <div class="code">
  804. selector : {
  805. input : '> input[type="hidden"]',
  806. item : '.menu > .item',
  807. menu : '.menu',
  808. text : '> .text'
  809. }
  810. </div>
  811. </td>
  812. </tr>
  813. <tr>
  814. <td>metadata</td>
  815. <td colspan="2">
  816. <div class="code">
  817. metadata: {
  818. text : 'text',
  819. value : 'value'
  820. }
  821. </div>
  822. </td>
  823. </tr>
  824. <tr>
  825. <td>className</td>
  826. <td colspan="2">
  827. <div class="code">
  828. className : {
  829. active : 'active',
  830. disabled : 'disabled',
  831. placeholder : 'default',
  832. visible : 'visible'
  833. }
  834. </div>
  835. </td>
  836. </tr>
  837. </tbody>
  838. </table>
  839. <h3 class="ui header">
  840. Debug Settings
  841. <div class="sub header">Debug settings controls debug output to the console</div>
  842. </h3>
  843. <table class="ui celled sortable definition table segment">
  844. <thead>
  845. <tr>
  846. <th>Setting</th>
  847. <th class="four wide">Default</th>
  848. <th>Description</th>
  849. </tr>
  850. </thead>
  851. <tbody>
  852. <tr>
  853. <td>name</td>
  854. <td>Dropdown</td>
  855. <td>Name used in debug logs</td>
  856. </tr>
  857. <tr>
  858. <td>debug</td>
  859. <td>True</td>
  860. <td>Provides standard debug output to console</td>
  861. </tr>
  862. <tr>
  863. <td>performance</td>
  864. <td>True</td>
  865. <td>Provides standard debug output to console</td>
  866. </tr>
  867. <tr>
  868. <td>verbose</td>
  869. <td>True</td>
  870. <td>Provides ancillary debug output to console</td>
  871. </tr>
  872. <tr>
  873. <td>error</td>
  874. <td colspan="2">
  875. <div class="code">
  876. error : {
  877. action : 'You called a dropdown action that was not defined',
  878. method : 'The method you called is not defined.',
  879. transition : 'The requested transition was not found'
  880. }
  881. </div>
  882. </td>
  883. </tr>
  884. </tbody>
  885. </table>
  886. </div>
  887. </div>