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.

179 lines
6.0 KiB

11 years ago
  1. # Semantic
  2. Semantic is a set of specifications for sharing UI elements between developers. Semantic is also a UI library to make front end development simpler and easier to learn.
  3. ## The Library
  4. ### Getting Started
  5. The Semantic library describes many UI elements. In most instances it might be best to build a custom build with only the elements you need.
  6. You can use our build tool to select only the components you want
  7. http://semantic-ui.com/download
  8. Or download the entire library and build out the code yourself using [Grunt](http://gruntjs.com/) or another package management system.
  9. git clone git@github.com:quirkyinc/semantic.git
  10. If you prefer to download the whole kit and kaboodle you can grab that as well.
  11. http://semantic-ui.com/ui/semantic.min.css
  12. http://semantic-ui.com/ui/semantic.min.js
  13. ## The Specification
  14. The aim of the semantic specification is to create conventions for structuring and naming code for describing interface elements. By defining a vocabulary for interface elements based on consensus, and convention, we can increase portability of UI design.
  15. ### What it defines
  16. **For all ui**: Defines class name and html structures which can be used to represent an element
  17. **For elements**: Outlines states that an elements can exist, lists common types, or variations, of an element, and if necessary, defines how the element functions in groups.
  18. **For collections**: Defines a list of elements that it can include, and ways which variations in the collection can affect each element.
  19. **For modules**: Defines a set of behaviors the module is expected to perform.
  20. **For views**: Defines the types of content it usually contains, and a standard heirarchy for presenting the content to the user.
  21. ### How it is defined
  22. #### Based on class
  23. Semantic is based on class names, instead of tags. This means, except for links, tables and form elements, you can use semantic with tags like ``<div> <article> <nav>`` without any difference.
  24. #### Context sensitive
  25. In Semantic, variations maintain context based on the element they modify, but keep the same vocabulary between elements. Just like how in English, the adjective 'big' may describe a different scale for a big planet versus a big insect.
  26. For example, a form you can have a variation called "inverted". This changes the appearance of form elements to work on dark backgrounds.
  27. ```html
  28. <div class="ui inverted form">
  29. <div class="field">
  30. <label>Name</label>
  31. <input type="text">
  32. </div>
  33. </div>
  34. ```
  35. The same variation can also be useful in the context of a menu.
  36. ```html
  37. <div class="ui inverted menu">
  38. <div class="item">Section 1</div>
  39. <div class="dropdown item">
  40. Dropdown
  41. <div class="menu">
  42. <div class="item">Dropdown item 1</div>
  43. <div class="item">Dropdown item 2</div>
  44. </div>
  45. </div>
  46. </div>
  47. ```
  48. #### Example
  49. Here is part of Semantic's definition of a button
  50. **Standard**: A button is a shape that can be pressed in to complete an action.
  51. ```html
  52. <div class="ui button"></div>
  53. ```
  54. **State**: A button can sometimes be active, designating it is selected by the user.
  55. ```html
  56. <div class="ui active button">
  57. ```
  58. **Variations**: A button may sometimes look different than its prototype.
  59. ```html
  60. <div class="ui large blue icon button">
  61. <i class="ui icon heart"></i>
  62. </div>
  63. ```
  64. **Plurality**: A button can sometimes exist in a group of buttons
  65. ``` html
  66. <div class="ui large blue buttons">
  67. <div class="ui button">
  68. I am blue
  69. </div>
  70. <div class="ui button">
  71. I am blue too
  72. </div>
  73. </div>
  74. ```
  75. ## Types of UI
  76. UI components are split into four categories, ranging from smallest to largest:
  77. * UI Elements
  78. * UI Collections
  79. * UI Modules
  80. * UI Views
  81. All UI definitions are made of a neutral, ideal definition, a list of states it can occupy, and a set of common variations or "types" of that element.
  82. ### UI Elements
  83. UI Elements are interface elements which do not contain other elements inside themselves. This can be thought of as similar in definition as an "element" in chemistry.
  84. UI elements can have plural definitions when they are known to exist together frequently.
  85. In this case each button will be large because we understand it is a part of the large button group
  86. ``` html
  87. <div class="large buttons">
  88. <div class="ui button">Cancel</div>
  89. <div class="ui positive button">Continue</div>
  90. </div>
  91. ```
  92. Examples of UI elements:
  93. * Buttons
  94. * Labels
  95. * Headers
  96. * Progress bars
  97. ### UI Collections
  98. UI Collections are groups of heteregeneous UI elements which are usually found together. Carrying the chemistry metaphor, these can be thought of as molecules.
  99. UI collections have a definition of elements that exist, or could exist inside of them. They do not usually require all elements to be found, but they describe a list of the "usual suspects". Unlike elements, collections are not typically useful to define in plural.
  100. Examples of UI collections:
  101. * Forms
  102. * Tables
  103. * Grids (Layout)
  104. * Menus
  105. ## UI Modules
  106. UI modules are elements where it's behavior is a fundamental part of its definition. UI Modules are dependent on the javascript which carry their definition. They also may be more complex, and have a variety of different functions. Further abusing the scientific analogy: These can be thought of as "organs".
  107. Examples of UI modules:
  108. * Popups
  109. * Modals
  110. * Chatrooms
  111. * Calendar Pickers
  112. ## UI Views
  113. UI Views are common ways to structure types of content so that it can be understood more easily. A view's definition in semantic only describes the content which typically occupies the view.
  114. For example an activity feed in
  115. This is a UI
  116. Examples of UI views:
  117. ** Comment Feed
  118. ** Activity Feed
  119. ** Product List
  120. ## Usage
  121. ### Specification
  122. #### I want to contribute to the spec
  123. Semantic is very new standard, and we need a community to become truly useful. We're working currently to determine the best ways to engage the community for contribution. If you'd like to participate feel free to reach out by e-mail [semantic@quirky.com](mailto:semantic@quirky.com)