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.

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