--- layout : 'default' css : 'guide' title : ' Getting Started' type : 'UI Specification' ---

Getting Started

Installing

Semantic uses an eponymous package manager written in node. To begin you must install nodejs and npm for your platform.

After these dependencies are ready to go, you can install semantic using npm

npm install -g semantic

Usage

Components are given a namespace. This makes sure the css rules dont interfere with other rules on your page.

semantic add button
Button
.ui.button { font-size: 14px; }

If multiple components are available of the same type, you can specify which one to use by adding the package's name before. A package name is different than its namespace, for example there may be many types of buttons.

semantic search button >> 2 buttons were found: >> fancy button - a collection of buttons formatted for a blog - 15 variations, 3 types >> semantic button - the official button collection of semantic - 10 variations, 5 types

Components will download inside a directory. To use these components, simply link to their javascript and css in a web page

So I downloaded a component, now what?

Semantic components are self documenting, that means documentation are generated automatically after you download. You can see the element and code samples by simply opening up the corresponding html file.

/ui/specification/button.html

You can view an example of an element definition by checking out the docs for semantic's first party button definition

View button definition

Why Use Semantic?

Semantic sees website development as the coallescence of two things: Re-usable UI Components + Discardable Page Glue

Semantic is a framework for writing portable UI components, which helps you and others re-use and re-skin your ui elements in their projects.

Definitions and Language

Natural language is particularly good at describing visual scenes, i.e. dogs, trees, flowers and hard at defining abstractions: behavior, emotions, etc. Where programming languages are particularly good at describing behavior, but can be more obtuse at describing layouts.

Semantic adopts concepts from natural languages like: plurals, adjectives, and tense so web developers can enjoy some of the more useful features of natural language. Semantic also aspires for developers to make decision based on common usage instead of deciding arbitrarily how to name things.

For example if a developer wants to include a set of red buttons with icons on a page he can simple grab the semantic button and icon component:

semantic add button semantic add icon
and then include in html:

Authoring

Creating a component in semantic requires two steps:

  1. Defining how your element can look.
  2. Writing code to match your definitions

These steps can be completed in either order. If you enjoy Test-Driven-Development, you can write your specification before coding, or if you prefer a more ad-hoc approach you can swap the order, defining your element only after you finish describing it.

Consuming

Semantic is a package manager, created by other people is a simple process

  1. Search semantic for a type of UI component
  2. Open up its specification to see what it can do and how to use it.
Semantic components are self documenting, giving you the ability to download a component, and get working immediately. Each component contains a spec file, which describes what a component can do. This is used to generate documentation automatically that lives alongside your project, making sure you know exactly what exists in your CSS.