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.

534 lines
16 KiB

  1. ---
  2. layout : 'default'
  3. css : 'form'
  4. title : 'Form'
  5. description : 'A form is a collection of user input elements'
  6. type : 'UI Collection'
  7. ---
  8. <script src="/javascript/form.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">Elements</a>
  15. <a class="item">States</a>
  16. <a class="item">Variations</a>
  17. <a class="item">Groups</a>
  18. </div>
  19. </div>
  20. <h2 class="ui dividing header">Types</h2>
  21. <div class="example">
  22. <h4 class="ui header">Form:</h4>
  23. <p>
  24. Forms always include fields, and fields always contain form elements. Fields themselves may also include:
  25. <a href="/elements/input.html">inputs</a>, standard form fields, <a href="/elements/label.html">labels</a>, <a href="/modules/dropdown.html">selection dropdowns</a>, textareas, as well as:
  26. <a href="/modules/checkbox.html">checkboxes</a>, and <a href="/collections/message.html">message blocks</a>.
  27. </p>
  28. <p>Validation messages use <a href="/collections/message.html">messages</a> which are formatted for use inside forms.</p>
  29. <div class="ui ignored warning message">
  30. <p>If you are looking for form validation, you should check out <a href="/modules/form.html">form validation</a>.</p>
  31. </div>
  32. <div class="ui ignored info message">
  33. <p>This example uses a <a href="/elements/segment.html">ui segment</a> to add the padding and background color. This is not required.</p>
  34. </div>
  35. <div class="ui form segment">
  36. <div class="field">
  37. <label>Username</label>
  38. <div class="ui left labeled icon input">
  39. <input type="text" placeholder="Username">
  40. <i class="user icon"></i>
  41. <div class="ui corner label">
  42. <i class="icon asterisk"></i>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="field">
  47. <label>Password</label>
  48. <div class="ui left labeled icon input">
  49. <input type="password">
  50. <i class="lock icon"></i>
  51. <div class="ui corner label">
  52. <i class="icon asterisk"></i>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="ui error message">
  57. <div class="header">We noticed some issues</div>
  58. </div>
  59. <div class="ui blue submit button">Login</div>
  60. </div>
  61. </div>
  62. <h2 class="ui dividing header">Elements</h2>
  63. <div class="example">
  64. <h4 class="ui header">Field</h4>
  65. <p>A field is a form element containing a label and an input</p>
  66. <div class="ui form">
  67. <div class="field">
  68. <label>User Input</label>
  69. <input type="text">
  70. </div>
  71. </div>
  72. </div>
  73. <div class="example">
  74. <h4 class="ui header">Text Area</h4>
  75. <p>A textarea uses the default form element</p>
  76. <div class="ui form">
  77. <div class="field">
  78. <label>User Text</label>
  79. <textarea></textarea>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="no example">
  84. <h4 class="ui header">Checkbox</h4>
  85. <p><a href="/modules/checkbox.html">UI Checkboxes</a> are styled forms of standard form checkboxes.</p>
  86. <div class="evaluated code" data-type="javascript" data-label="true">
  87. $('.ui.checkbox')
  88. .checkbox()
  89. ;
  90. </div>
  91. <div class="ui form">
  92. <div class="inline field">
  93. <div class="ui checkbox">
  94. <input type="checkbox" />
  95. <label>Checkbox</label>
  96. </div>
  97. </div>
  98. <div class="inline field">
  99. <div class="ui slider checkbox">
  100. <input type="checkbox" />
  101. <label>Slider</label>
  102. </div>
  103. <label></label>
  104. </div>
  105. <div class="inline field">
  106. <div class="ui toggle checkbox">
  107. <input type="checkbox" />
  108. <label>Toggle</label>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="no form example">
  114. <h4 class="ui header">Select</h4>
  115. <p>A selection dropdown, a type of <a href="/modules/dropdown.html">ui dropdown</a> can be used to allow for a selection from multiple choices</p>
  116. <div class="evaluated code" data-type="javascript" data-label="true">
  117. $('.ui.selection.dropdown')
  118. .dropdown()
  119. ;
  120. </div>
  121. <div class="ui selection dropdown">
  122. <input type="hidden" name="gender">
  123. <div class="default text">Gender</div>
  124. <i class="dropdown icon"></i>
  125. <div class="menu">
  126. <div class="item" data-value="male">Male</div>
  127. <div class="item" data-value="female">Female</div>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="no example">
  132. <h4 class="ui header">Radio Box</h4>
  133. <p>Radio boxes are styled forms of standard form radio controls.</p>
  134. <div class="evaluated code" data-type="javascript" data-label="true">
  135. $('.ui.radio.checkbox')
  136. .checkbox()
  137. ;
  138. </div>
  139. <div class="ui form">
  140. <div class="grouped inline fields">
  141. <div class="field">
  142. <div class="ui radio checkbox">
  143. <input type="radio" name="fruit" checked />
  144. <label>Apples</label>
  145. </div>
  146. </div>
  147. <div class="field">
  148. <div class="ui radio checkbox">
  149. <input type="radio" name="fruit" />
  150. <label>Oranges</label>
  151. </div>
  152. </div>
  153. <div class="field">
  154. <div class="ui radio checkbox">
  155. <input type="radio" name="fruit" />
  156. <label>Pears</label>
  157. </div>
  158. </div>
  159. <div class="field">
  160. <div class="ui radio checkbox">
  161. <input type="radio" name="fruit" />
  162. <label>Grapefruit</label>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="example">
  169. <h4 class="ui header">Text Block</h4>
  170. <p>Text blocks have special meaning inside a form tag. Any info, error, or warning message blocks found inside a form are hidden by default.</p>
  171. <div class="ui form">
  172. <div class="ui message">
  173. <div class="header">We had some issues</div>
  174. <ul class="list">
  175. <li>Please enter your first name</li>
  176. <li>Please enter your last name</li>
  177. </ul>
  178. </div>
  179. </div>
  180. </div>
  181. <h2 class="ui dividing header">States</h2>
  182. <h3 class="ui header">Form</h3>
  183. <div class="example">
  184. <h4 class="ui header">Loading</h4>
  185. <p>If a form is in loading state, it will automatically show a loading indicator:</p>
  186. <div class="ui loading form segment">
  187. <div class="two fields">
  188. <div class="field">
  189. <label>First Name</label>
  190. <input placeholder="First Name" type="text">
  191. </div>
  192. <div class="field">
  193. <label>Last Name</label>
  194. <input placeholder="Last Name" type="text">
  195. </div>
  196. </div>
  197. <div class="field">
  198. <label>Username</label>
  199. <input placeholder="Username" type="text">
  200. </div>
  201. <div class="field">
  202. <label>Password</label>
  203. <input type="password">
  204. </div>
  205. <div class="inline field">
  206. <div class="ui checkbox">
  207. <input type="checkbox" />
  208. <label>I agree to the terms and conditions</label>
  209. </div>
  210. </div>
  211. <div class="ui blue submit button">Submit</div>
  212. </div>
  213. </div>
  214. <div class="example">
  215. <h4 class="ui header">Error</h4>
  216. <p>If a form is in an error state, it will automatically show any error message blocks:</p>
  217. <div class="ui error form segment">
  218. <div class="ui error message">
  219. <div class="header">Action Forbidden</div>
  220. <p>You can only sign up for an account once with a given e-mail address.</p>
  221. </div>
  222. <div class="two fields">
  223. <div class="field">
  224. <label>First Name</label>
  225. <input placeholder="First Name" type="text">
  226. </div>
  227. <div class="field">
  228. <label>Last Name</label>
  229. <input placeholder="Last Name" type="text">
  230. </div>
  231. </div>
  232. <div class="field">
  233. <label>Username</label>
  234. <input placeholder="Username" type="text">
  235. </div>
  236. <div class="field">
  237. <label>Password</label>
  238. <input type="password">
  239. </div>
  240. <div class="inline field">
  241. <div class="ui checkbox">
  242. <input type="checkbox" />
  243. <label>I agree to the Terms and Conditions</label>
  244. </div>
  245. </div>
  246. <div class="ui blue submit button">Submit</div>
  247. </div>
  248. </div>
  249. <div class="example">
  250. <h4 class="ui header">Warning</h4>
  251. <p>If a form is in warning state, it will automatically show any warning message block:</p>
  252. <div class="ui warning form segment">
  253. <div class="ui warning message">
  254. <div class="header">Could you check something!</div>
  255. <ul class="list">
  256. <li>You forgot your <b>first name</b></li>
  257. <li>And also your <b>last name</b></li>
  258. </ul>
  259. </div>
  260. <div class="two error fields">
  261. <div class="field">
  262. <label>First Name</label>
  263. <input placeholder="First Name" type="text">
  264. <div class="ui red pointing above ui label">Enter a first name</div>
  265. </div>
  266. <div class="field">
  267. <label>Last Name</label>
  268. <input placeholder="Last Name" type="text">
  269. <div class="ui red pointing above ui label">Enter a last name</div>
  270. </div>
  271. </div>
  272. <div class="field">
  273. <label>Username</label>
  274. <input placeholder="Username" type="text">
  275. </div>
  276. <div class="field">
  277. <label>Password</label>
  278. <input type="password">
  279. </div>
  280. <div class="inline field">
  281. <div class="ui checkbox">
  282. <input type="checkbox" />
  283. <label>I agree to the Terms and Conditions</label>
  284. </div>
  285. </div>
  286. <div class="ui blue submit button">Submit</div>
  287. </div>
  288. </div>
  289. <h3 class="ui header">Form Fields</h3>
  290. <div class="example">
  291. <h4 class="ui header">Error</h4>
  292. <p>Individual fields may contain an error state</p>
  293. <div class="ui form segment">
  294. <div class="two fields">
  295. <div class="field error">
  296. <label>First Name</label>
  297. <input placeholder="First Name" type="text">
  298. </div>
  299. <div class="field">
  300. <label>Last Name</label>
  301. <input placeholder="Last Name" type="text">
  302. </div>
  303. </div>
  304. </div>
  305. </div>
  306. <div class="example">
  307. <h4 class="ui header">Disabled</h4>
  308. <p>Individual fields may be disabled or read only</p>
  309. <div class="ui form segment">
  310. <div class="two fields">
  311. <div class="field">
  312. <label>First Name</label>
  313. <input placeholder="Read Only" readonly="readonly" type="text">
  314. </div>
  315. <div class="disabled field">
  316. <label>Last Name</label>
  317. <input placeholder="Disabled" disabled="disabled" type="text">
  318. </div>
  319. </div>
  320. </div>
  321. </div>
  322. <h2 class="ui dividing header">Variations</h2>
  323. <h3 class="ui header">Forms</h3>
  324. <div class="example">
  325. <h4 class="ui header">Fluid</h4>
  326. <p>A form can take the width of its container</p>
  327. <div class="ui fluid form segment">
  328. <div class="two fields">
  329. <div class="field">
  330. <label>First Name</label>
  331. <input placeholder="First Name" type="text">
  332. </div>
  333. <div class="field">
  334. <label>Last Name</label>
  335. <input placeholder="Last Name" type="text">
  336. </div>
  337. </div>
  338. <div class="ui blue submit button">Submit</div>
  339. </div>
  340. </div>
  341. <div class="example">
  342. <h4 class="ui header">Size</h4>
  343. <p>A form can also be small or large</p>
  344. <div class="ui small form segment">
  345. <div class="two fields">
  346. <div class="field">
  347. <label>First Name</label>
  348. <input placeholder="First Name" type="text">
  349. </div>
  350. <div class="field">
  351. <label>Last Name</label>
  352. <input placeholder="Last Name" type="text">
  353. </div>
  354. </div>
  355. <div class="ui blue small submit button">Submit</div>
  356. </div>
  357. <br><br>
  358. <div class="ui large form segment">
  359. <div class="two fields">
  360. <div class="field">
  361. <label>First Name</label>
  362. <input placeholder="First Name" type="text">
  363. </div>
  364. <div class="field">
  365. <label>Last Name</label>
  366. <input placeholder="Last Name" type="text">
  367. </div>
  368. </div>
  369. <div class="ui blue submit button">Submit</div>
  370. </div>
  371. </div>
  372. <div class="example">
  373. <h4 class="ui header">Inverted</h4>
  374. <p>A form on a dark background may have to invert its color scheme</p>
  375. <div style="background-color: #333333; padding: 15px;">
  376. <div class="ui inverted form">
  377. <div class="ui info message">
  378. <div class="header">We had some issues</div>
  379. <ul class="list">
  380. <li>Please enter your first name</li>
  381. <li>Please enter your last name</li>
  382. </ul>
  383. </div>
  384. <div class="two fields">
  385. <div class="field">
  386. <label>First Name</label>
  387. <input placeholder="First Name" type="text">
  388. </div>
  389. <div class="field">
  390. <label>Last Name</label>
  391. <input placeholder="Last Name" type="text">
  392. </div>
  393. </div>
  394. <div class="ui blue submit button">Submit</div>
  395. </div>
  396. </div>
  397. </div>
  398. <h3 class="ui header">Fields</h3>
  399. <div class="example">
  400. <h4 class="ui header">Inline</h4>
  401. <p>A field can have its label next to instead of above it.</p>
  402. <div class="ui form">
  403. <div class="inline field">
  404. <label>Last name</label>
  405. <input type="text" placeholder="Full Name">
  406. </div>
  407. </div>
  408. </div>
  409. <div class="example">
  410. <h4 class="ui header">Date</h4>
  411. <p>A field can let users know they are for dates</p>
  412. <div class="ui form">
  413. <div class="date field">
  414. <label>Birthday</label>
  415. <input type="text" placeholder="xx/xx/xxxx">
  416. </div>
  417. </div>
  418. </div>
  419. <h2 class="ui dividing header">Groups</h2>
  420. <div class="example">
  421. <h4 class="ui header">Fields</h4>
  422. <p>Fields can exist together side by side</p>
  423. <div class="ui form">
  424. <div class="ui three fields">
  425. <div class="field">
  426. <label>First name</label>
  427. <input type="text" placeholder="First Name">
  428. </div>
  429. <div class="field">
  430. <label>Middle name</label>
  431. <input type="text" placeholder="Middle Name">
  432. </div>
  433. <div class="field">
  434. <label>Last name</label>
  435. <input type="text" placeholder="Last Name">
  436. </div>
  437. </div>
  438. </div>
  439. </div>
  440. <div class="example">
  441. <h4 class="ui header">Grouped Fields</h4>
  442. <p>Fields can be grouped to show related choices</p>
  443. <div class="ui form">
  444. <div class="grouped inline fields">
  445. <div class="field">
  446. <div class="ui radio checkbox">
  447. <input type="radio" name="fruit" />
  448. <label></label>
  449. </div>
  450. <label> Apples</label>
  451. </div>
  452. <div class="field">
  453. <div class="ui radio checkbox">
  454. <input type="radio" name="fruit" />
  455. <label></label>
  456. </div>
  457. <label> Oranges</label>
  458. </div>
  459. <div class="field">
  460. <div class="ui radio checkbox">
  461. <input type="radio" name="fruit" />
  462. <label></label>
  463. </div>
  464. <label> Pears</label>
  465. </div>
  466. <div class="field">
  467. <div class="ui radio checkbox">
  468. <input type="radio" name="fruit" />
  469. <label></label>
  470. </div>
  471. <label> Grapefruit</label>
  472. </div>
  473. </div>
  474. </div>
  475. </div>
  476. <div class="example">
  477. <h4 class="ui header">Inline</h4>
  478. <p>Multiple fields may be inline in a row</p>
  479. <div class="ui form">
  480. <div class="inline fields">
  481. <div class="field">
  482. <label>Phone Number</label>
  483. <input type="text" placeholder="(xxx)">
  484. </div>
  485. <div class="field">
  486. <input type="text" placeholder="xxx">
  487. </div>
  488. <div class="field">
  489. <input type="text" placeholder="xxxx">
  490. </div>
  491. </div>
  492. </div>
  493. </div>
  494. </div>