What is Semantic?
Semantic has two parts. The semantic specification, and the semantic library.
The UI Specification
The semantic specification creates a standard language for describing user interface elements.
UI Elements | UI Only | menus, columns, grids, tables, buttons, forms |
UI Modules | UI + Behavior | popups, modals, chat rooms |
Behavioral Modules | Behavior Only | form validation, state management, polyfills, history |
Exchanging Designs
Semantic defines HTML structures and class names for UI elements that attempt to create a common vernacular to make front end development less prescriptive.
Sharing language for UI releases the burden from developers at making arbitrary decisions, like naming conventions, in their own projects, and opens up the ability to swap website designs without having to restructure your codebase.
What's in an Element?
UI elements definitions are made of 4 parts:
A prototype form of an element | A bunny has two long ears and is furry |
A definition of the relationship between a plural and singular instance of an element | Three white bunnies are each white |
A definition of possible variations of the element | A bunny can be large or small and can be spotted or fuzzy |
A list of states which the element can exist | A bunny can either be hopping, eating or sitting still |
UI elements can be thought of as nouns, and variations as adjectives. Variations are written so to only describe the innate features of that variation, and must account for the differences when declared along-side other variations.
For example, in English, a large planet has a different meaning than a large chair, and would require different specific contextual definitions, but both are the same variant "largeness" to the person using the word.
Variations can be used together without negating each other unless used in a paradoxical way (A large small bunny).
Just Show Me the Code
If you'd like to shortcut any more explanation, check out the standard definition for a UI button for a live example.
UI Button SpecThe Module Specification
In Semantic, modules are user interface elements which require a behavioral definition. For example, a pop-up is understood by the actual action that occurs, it "pops up". Without this logic any pop-up is incomplete.
Semantic UI modules have two components, a definition of the UI element and a behavioral definition in javascript. Semantic includes a standard javascript module pattern, which helps in defining interface elements in a similar context to UI.
The goal of the module design pattern is primarily to accomplish three things:
- Make debugging modules simpler by making techniques like performance profiling, and logging easier and more useful.
- Make understanding new code easier, by defining a common pattern for initializing, destroying elements, modifying settings, and allowing more advanced features.
- Reduce prescriptive aspects of
Why use Semantic Modules?
- Puts accessibility first.
Although Coffeescript is beautiful, and Angular is smart, Semantic has a different agenda: to be easy to use, and opinionless. Semantic can be thought of more as the Aaron Copland of programming libraries. It only requires an understanding of jQuery and Javascript to begin writing code. If you're stuck there are also plenty of examples to help you get started.
- Is self documenting.
Instead of reading through inline comments to determine what a developer is intending, semantic allows developers to pass meaningful debug data where its most useful: the javascript console. This allows you to see the sequence of events that occur in a module , along with useful debug information, like the value of significant variables. If you're in the source code, debug statements also read similarly to code comments which provide context. Show me
- Separates arbitrary decisions from the fundamental mechanics of your module.
Ever scroll through an unfimiliar library looking for the line of code where they define the ID tag for an expected html structure? Semantic keeps you from ever having to do that again. Developer decisions like metadata, classnames, selectors, and messages are separated from the less arbitrary parts of code. Show me
- Lets you access anything, and change everything.
Methods defined as part of module definitions are all invokable. Semantic also maps from dot notation to their appropriate locations inside the module, allowing developers not to only make flat modules. Settings can be changed at initialization, or after. Module defaults can be changed whenever. Show me
- Plays nice with other libraries.
Modules include a destroy method which will remove any bound events or initialized code. Modules also use namespaced events so you can have more flexibility over defining and clearing them
- Patterns for every need.
Semantic has patterns that work well both as a widget factory, and as a single entity.
You really like to talk. Lets see some code
For a complete definition of the specification check to annotated source:
The Libraries
To semantic library is a set of UI elements and javascript modules that provides an example implementation of the Semantic standard. The purpose is to be useful in their own right for developers, but also to provide a guide for how the standard can be used.
The UI Library
- Buttons
- Text
- Headers
- Columns
- Elements (Grid System)
- Tags
- Items (Lists of Content)
- Panels (Type of Menu)
- Forms
- Fields
- Checkboxes
- Icons
- Dividers
The module library
Javascript modules.
- Accordion
- API
- Animation
- Chat Room
- Form Validation
- Placeholder Text
- Modal
- Nag
- Popup
- Search
- Star Rating
- Shape
- State
- Tabs