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.

192 lines
6.5 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. ## Development Status
  4. Semantic is pre-release. Build tools are not yet available, and APIs may be updated regularly prior to 1.0, so be warned!
  5. Please [share any issues](https://github.com/jlukic/Semantic-UI/issues?state=open) you may have, we need your help to get all the kinks out.
  6. ## The Library
  7. ### Getting Started
  8. 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.
  9. *Build tools are not yet available but stay tuned!*
  10. ~~You can use our build tool to select only the components you want~~
  11. To download the entire library
  12. git clone git@github.com:quirkyinc/semantic.git
  13. If you prefer to download the whole kit as a zip, it is so conveniently packaged.
  14. http://semantic-ui.com/build/semantic.zip
  15. ## The Specification
  16. The aim of the specification is to develop conventions around structuring and naming code for interface elements.
  17. By defining a vocabulary the development community can exchange javascript and css definitions of UI in a similar language, making new code easier to grok, and reducing the complexity of starting a new project, or changing a sites design.
  18. ## Types of UI
  19. UI components are split into four categories, ranging from smallest to largest in scope:
  20. * UI Elements
  21. * UI Collections
  22. * UI Modules
  23. * UI Views
  24. ### UI Elements
  25. 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.
  26. UI elements can have plural definitions when they are known to exist together frequently.
  27. In this case each button will be large because we understand it is a part of the large button group
  28. ``` html
  29. <div class="large ui buttons">
  30. <div class="ui button">Cancel</div>
  31. <div class="ui button">Continue</div>
  32. </div>
  33. ```
  34. Examples of UI elements:
  35. * Buttons
  36. * Labels
  37. * Headers
  38. * Progress bars
  39. ### UI Collections
  40. UI Collections are groups of heteregeneous UI elements which are usually found together. Carrying the chemistry metaphor, these can be thought of as molecules.
  41. 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.
  42. Examples of UI collections:
  43. * Forms
  44. * Tables
  45. * Grids (Layout)
  46. * Menus
  47. ### UI Modules
  48. 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".
  49. Examples of UI modules:
  50. * Popups
  51. * Modals
  52. * Chatrooms
  53. ### UI Views
  54. 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.
  55. Examples of UI views:
  56. * Comment Feed
  57. * Activity Feed
  58. * Product List
  59. ### How it is defined
  60. #### Scope of a definition
  61. **All UI**: The specification defines class name and html structures which can be used to represent an element
  62. **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.
  63. **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.
  64. **Modules**: Module definitions include a list of behaviors that are commonly associated with an element
  65. **Views**: View specifications defines the types of content the view usually display, and the heirarchy typical to presenting this content to the user.
  66. #### Based on class
  67. 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.
  68. #### Context sensitive
  69. 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.
  70. For example, a form you can have a variation called "inverted". This changes the appearance of form elements to work on dark backgrounds.
  71. ```html
  72. <div class="ui inverted form">
  73. <div class="field">
  74. <label>Name</label>
  75. <input type="text">
  76. </div>
  77. </div>
  78. ```
  79. The same variation can also be useful in the context of a menu.
  80. ```html
  81. <div class="ui inverted menu">
  82. <div class="item">Section 1</div>
  83. <div class="ui simple dropdown item">
  84. Dropdown
  85. <div class="menu">
  86. <div class="item">Dropdown item 1</div>
  87. <div class="item">Dropdown item 2</div>
  88. </div>
  89. </div>
  90. </div>
  91. ```
  92. #### Example
  93. Here is part of Semantic's definition of a button
  94. **Standard**: A button is a shape that can be pressed in to complete an action.
  95. ```html
  96. <div class="ui button"></div>
  97. ```
  98. **State**: A button can sometimes be active, designating it is selected by the user.
  99. ```html
  100. <div class="ui active button">
  101. ```
  102. **Variations**: A button may sometimes look different than its prototype.
  103. ```html
  104. <div class="ui large blue icon button">
  105. <i class="ui icon heart"></i>
  106. </div>
  107. ```
  108. **Plurality**: A button can sometimes exist in a group of buttons
  109. ``` html
  110. <div class="ui large blue buttons">
  111. <div class="ui button">
  112. I am blue
  113. </div>
  114. <div class="ui button">
  115. I am blue too
  116. </div>
  117. </div>
  118. ```
  119. ## Usage
  120. ### Developers
  121. Prereqs Node, Grunt(``npm install -g grunt-cli``) and DocPad (``npm install -g docpad``)
  122. Inside ``node/`` use the command ``docpad run`` to start your server
  123. You can then access the docs locally at ``localhost:9778``
  124. To have DocPad watch for changes while working on a component simply run the command
  125. ``grunt``
  126. To build the release packages for Semantic
  127. ``grunt build``
  128. #### I want to contribute to the spec
  129. 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 [jack@myfav.es](mailto:jack@myfav.es)