Overview

Basics

Gas — components based UI library written in golang

Gas is modular, it consists of:

  1. Core — all logic stuff: update, render
  2. Backend — structure implementing backend interface. It contains platform specific code rendering application state.

Far this moment exists only web backend which allow you to create modern web application using only golang. You, of course, can use HTML, CSS and other web technologies

Elements

Elements (*gas.Element) are the building blocks of the application. Element fields:

  1. Tag — html tag (were it used)
  2. UUID — unique identificator (generated by frankenbeanies/uuid4)
  3. IsPointer — is element stored as variable (you change it by your hands if it's necessary)
  4. Attrs — function returning gas.Map - alias for map[string]string. It's function because sometimes you need make attribute dynamic.
  5. Handlers — element event listeners
  6. Parent — parent element (root application element parent is nil)
  7. HTML — func() string result replace in element inner html
  8. Component — linked component

Components

Components (*gas.Component) are the way to create elements with state. You manage some data in your own state (basically in structure) and update view by calling Component.Update(). To be used thy are rendered to Element by Init method. Components fields:

  1. Root — interface with Render func()[]interface{} method. You create structure, implements this method and use structure in component, that allows you to manage state.