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.

132 lines
4.9 KiB

  1. ---
  2. layout : 'default'
  3. css : 'guide'
  4. title : 'Spec Files'
  5. type : 'UI Specification'
  6. ---
  7. <%- @partial('header') %>
  8. <div class="main container">
  9. <h2>Introduction</h2>
  10. <p>Semantic defines an exchange format for user interface. Writing your interface components to match the specifications allows others to easily use your interface components in their project.</p>
  11. <h3>Writing a Spec File</h3>
  12. <p>Before authoring an element you should begin by writing a spec file for your element. A specification file defines the structure and names used inside your element. For more information on naming convention visit our css and html guides.</p>
  13. <p>A spec file also allows you to provide metadata to generate code for your element, this can be used to generate visual documentation of your element.</p>
  14. <h3>Common Specification</h3>
  15. <p>A spec file is a specially formatted json file.</p>
  16. <div class="code" type="javascript">
  17. {
  18. // your element name should be a single word and match to the classname of your element
  19. "Name": "Button",
  20. // you may include metadata
  21. "Author": "Jack Lukic",
  22. "Website": "http://www.semantic-ui.com"
  23. "Version": "2.0",
  24. // All elements must specify whether it is an element, collection, module, or behavior
  25. "Type": "Element",
  26. // Types are exclusive forms of your element. For example a button cannot be an icon button and a text button. The definitions of the html structure of each element is written using emmet syntax. These are used to generate html structures for your elements. For more information visit: http://docs.emmet.io/abbreviations/syntax/
  27. "Types": {
  28. "Standard" : ".ui.button",
  29. "Icon" : ".ui.icon.button > i.icon",
  30. }
  31. // States are ways which elements show an innate change in its quality.
  32. "States": {
  33. "Active" : "active",
  34. "Loading" : "loading",
  35. "Disabled" : "disabled"
  36. },
  37. // Variations are individual classnames which your element may receive to alter its look. Variations should, for the most part, be able to be used together to create more complex styles of an element.
  38. "Variations": {
  39. // If a set of variations are options of a single type (for example sizing may contain, small, medium, etc) then this can be defined as an array.
  40. "Size": [
  41. "mini",
  42. "tiny",
  43. "small",
  44. "medium",
  45. "large",
  46. "huge",
  47. "massive"
  48. ],
  49. "Color": [
  50. "black",
  51. "green",
  52. "red",
  53. "blue",
  54. "green",
  55. "red",
  56. "teal"
  57. ],
  58. "Ordinality": [
  59. "secondary",
  60. "tertiary"
  61. ],
  62. "Attached": [
  63. "attached top",
  64. "attached bottom",
  65. "attached left",
  66. "attached right"
  67. ],
  68. "Circular" : "circular",
  69. "Fluid" : "fluid"
  70. },
  71. // You may define a list of dummy text and selectors which can be filled with them. This is used by generators to export a style guide of your interface element. If you specify an array, each item will be used in order to fill the content of each match.
  72. "Text": {
  73. ".ui.button": ["Button", "Click Me", "Lorem Ipsum"]
  74. },
  75. // Your module may optionally include a text definition of its variations to help clarify their purpose. This may include the definition of types or variations
  76. "Definition": {
  77. "Standard" : "A simple button",
  78. "Icon" : "A button icon is formatted to contain only an icon",
  79. "Size" : "A button can vary in size",
  80. "Color" : "A button can have different colors",
  81. "Ordinality" : "A button can blend into a page",
  82. "Attached" : "A button can attach to other content",
  83. "Circular" : "A button can be circular",
  84. "Fluid" : "A button can be fluid"
  85. }
  86. }
  87. </div>
  88. <h3>UI Elements</h3>
  89. <p>A UI element is a basic building block of a website. It may have a singular or group (plural) definition</p>
  90. <div class="code" type="javascript">
  91. {
  92. // in addition to the parameters above an element may contain a definition for its singular and plural type
  93. "Types": {
  94. // these types can only exist for class="ui button"
  95. "Singular": {
  96. "Standard" : ".ui.button",
  97. "Icon" : ".ui.icon.button > i.add.icon",
  98. "Labeled Icon" : ".ui.labeled.icon.button > i.add.icon"
  99. },
  100. // these types can exist only for class="ui button"
  101. "Group": {
  102. "Standard" : ".ui.buttons > .button+.button+.button",
  103. "Icon" : ".ui.buttons > ( (.button > i.icon.user) + (.button > i.icon.heart) + (.button > i.icon.lab))",
  104. "Conditional" : ".ui.buttons > .button+.or+.button",
  105. "Vertical" : ".vertical.ui.buttons > .button+.button+.button"
  106. }
  107. }
  108. }
  109. </div>
  110. </div>