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.

175 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 specification is to develop conventions around structuring and naming code for interface elements.
  15. By defining a vocabulary the development community can exchange javascript and css definitions of UI in a similar language, making new code easier to grock, and reducing the complexity of starting a new project, or changing a sites design.
  16. ## Types of UI
  17. UI components are split into four categories, ranging from smallest to largest in scope:
  18. * UI Elements
  19. * UI Collections
  20. * UI Modules
  21. * UI Views
  22. ### UI Elements
  23. 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.
  24. UI elements can have plural definitions when they are known to exist together frequently.
  25. In this case each button will be large because we understand it is a part of the large button group
  26. ``` html
  27. <div class="large ui buttons">
  28. <div class="ui button">Cancel</div>
  29. <div class="ui button">Continue</div>
  30. </div>
  31. ```
  32. Examples of UI elements:
  33. * Buttons
  34. * Labels
  35. * Headers
  36. * Progress bars
  37. ### UI Collections
  38. UI Collections are groups of heteregeneous UI elements which are usually found together. Carrying the chemistry metaphor, these can be thought of as molecules.
  39. 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.
  40. Examples of UI collections:
  41. * Forms
  42. * Tables
  43. * Grids (Layout)
  44. * Menus
  45. ### UI Modules
  46. 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".
  47. Examples of UI modules:
  48. * Popups
  49. * Modals
  50. * Chatrooms
  51. * Calendar Pickers
  52. ### UI Views
  53. 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.
  54. Examples of UI views:
  55. * Comment Feed
  56. * Activity Feed
  57. * Product List
  58. ### How it is defined
  59. #### Scope of a definition
  60. **All UI**: The specification defines class name and html structures which can be used to represent an element
  61. **Elements**: An element definition gives states which an elements can occupy, common types of that element, and if necessary, defines how the element functions in groups.
  62. **Collections**: Collection definitions list elements that it can include, and variations which can apply to both the collection, or individual elements found in the collection.
  63. **Modules**: Module definitions include a list of behaviors that are commonly associated with an element
  64. **Views**: View specifications defines the types of content the view usually display, and the heirarchy typical to presenting this content to the user.
  65. #### Based on class
  66. 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.
  67. #### Context sensitive
  68. 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.
  69. For example, a form you can have a variation called "inverted". This changes the appearance of form elements to work on dark backgrounds.
  70. ```html
  71. <div class="ui inverted form">
  72. <div class="field">
  73. <label>Name</label>
  74. <input type="text">
  75. </div>
  76. </div>
  77. ```
  78. The same variation can also be useful in the context of a menu.
  79. ```html
  80. <div class="ui inverted menu">
  81. <div class="item">Section 1</div>
  82. <div class="ui simple dropdown item">
  83. Dropdown
  84. <div class="menu">
  85. <div class="item">Dropdown item 1</div>
  86. <div class="item">Dropdown item 2</div>
  87. </div>
  88. </div>
  89. </div>
  90. ```
  91. #### Example
  92. Here is part of Semantic's definition of a button
  93. **Standard**: A button is a shape that can be pressed in to complete an action.
  94. ```html
  95. <div class="ui button"></div>
  96. ```
  97. **State**: A button can sometimes be active, designating it is selected by the user.
  98. ```html
  99. <div class="ui active button">
  100. ```
  101. **Variations**: A button may sometimes look different than its prototype.
  102. ```html
  103. <div class="ui large blue icon button">
  104. <i class="ui icon heart"></i>
  105. </div>
  106. ```
  107. **Plurality**: A button can sometimes exist in a group of buttons
  108. ``` html
  109. <div class="ui large blue buttons">
  110. <div class="ui button">
  111. I am blue
  112. </div>
  113. <div class="ui button">
  114. I am blue too
  115. </div>
  116. </div>
  117. ```
  118. ## Usage
  119. ### Specification
  120. #### I want to contribute to the spec
  121. 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)