A minimal material design based UI toolkit for Tiny Go projects

Tiny Gui

A minimal material design based UI toolkit for Tiny Go projects.

Warning: This library is in an alpha state there is currently no API stability guarantee.

Why

Microcontrollers have limited ram and flash storage a tyical UI toolkit will will require the construction of a component tree at run time that consumes ram. This component tree often includes both the structural definition of the UI and the state of the UI components. Through careful coding a component tree could be constructed as a compile time constant but such a UI would not be very dynamic.

How

A Tiny Gui is instead created by rendering UI components in sequence programmatically in this way the component structure is guaranted to be in flash memory and through the usage of normal control flow statements (if,for) complex dynamic UIs can be constructed. This is often referred to as an immediate mode gui.

TinyGui additionaly performs zero allocations during rendering. The only memory usage is the stack during rendering and the minimal state for the components. When not actively rendering the only memory usage is the state of the components.

Basic Example

This example will toggle an LED when a button is clicked.

Toggle LED Screenshot

package toggleled

import (
	"github.com/spearson78/tinygui"
	"github.com/spearson78/tinygui/component"

	"machine"
)

//State variable to track whether LED is on or off
var LedState bool

//State for Toggle Button
var btnToggleLed component.ButtonState

//Gui Function GuiContext is provided by Tiny Gui
func ToggleLedGui(g *tinygui.GuiContext) {

	//Create button props including default values based on current theme
	btnToggleProps := component.NewButtonProps(g)

	//Set position and Size of the button
	btnToggleProps.X = 10
	btnToggleProps.Y = 10
	btnToggleProps.W = 220
	btnToggleProps.H = 50

	//Set the label of the button
	btnToggleProps.Label = "TOGGLE LED"

	//Set the style of the button
	btnToggleProps.Style = component.Contained

	//Render the Button and handle the click
	if component.Button(g, &btnToggleLed, &btnToggleProps) {
		//component.Button returns true if the button was clicked
		LedState = !LedState
		machine.LED.Set(LedState)
	}
}

See the examples and cmd folders for more examples

Screenshots

Calculator Screenshot

Touch Calibration Screenshot

Temperature Dashboard Screenshot

Other Components Screenshot

Similar Resources

Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Dec 28, 2022

Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Jan 1, 2023

👻 Tiny Footprint Concurrent UI library for Fiber.

👻 Tiny Footprint Concurrent UI library for Fiber.

Development and Maintenance Status RancherOS 1.x is no longer being actively maintained. There are two significant reasons behind this product decisio

Jan 5, 2022

A list of Go GUI projects

(Please follow @Go100and1 for updates on this page, and all kinds of details and facts in Go). A list of Go GUI/graphics/image related projects native

Jan 3, 2023

GPU based Electron on a diet

Muon is a lightweight alternative to Electron written in Golang in about ~300 LoC, using Ultralight instead of Chromium. Ultralight is a cross-platfor

Jan 2, 2023

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

go-flutter - A package that brings Flutter to the desktop Purpose Flutter allows you to build beautiful native apps on iOS and Android from a single c

Jan 9, 2023

Cross platform rapid GUI framework for golang based on Dear ImGui.

Cross platform rapid GUI framework for golang based on Dear ImGui.

giu Cross platform rapid GUI framework for golang based on Dear ImGui and the great golang binding imgui-go. Any contribution (features, widgets, tuto

Dec 28, 2022

GTK3-based dock for sway

GTK3-based dock for sway

nwg-dock Fully configurable (w/ command line arguments and css) dock, written in Go, aimed exclusively at sway Wayland compositor. It features pinned

Dec 23, 2022

Cross platform GUI in Go based on Material Design

Cross platform GUI in Go based on Material Design

About Fyne is an easy to use UI toolkit and app API written in Go. It is designed to build applications that run on desktop and mobile devices with a

Jan 3, 2023

Material Design Components for use with Vecty in the most minimalistic fashion.

mdc Material Design Components for use with Vecty in the most minimalistic, dead simple fashion. Currently on MDC version 13.0.0. Based on the good wo

Mar 6, 2022

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

Learn how to design large-scale systems. Prep for the system design interview.  Includes Anki flashcards.

English ∙ 日本語 ∙ 简体中文 ∙ 繁體中文 | العَرَبِيَّة‎ ∙ বাংলা ∙ Português do Brasil ∙ Deutsch ∙ ελληνικά ∙ עברית ∙ Italiano ∙ 한국어 ∙ فارسی ∙ Polski ∙ русский язы

Jan 9, 2023

Go-design-pattern-examples - Golang implementations of common design patterns

Design Patterns Golang implementations of common design patterns Build project T

Oct 29, 2022

This slide deck and supporting material is part of the Introduction to Go training course by Dave Cheney

This slide deck and supporting material is part of the Introduction to Go training course by Dave Cheney.

Nov 14, 2022

Go Training Class Material :

Go Training Review our different courses and material To learn about Corporate training events, options and special pricing please contact: William Ke

Dec 28, 2022

Light weight Terminal User Interface (TUI) to pick material colors written by Go.

Light weight Terminal User Interface (TUI) to pick material colors written by Go.

mcpick Light weight Terminal User Interface (TUI) to pick material colors. You do NOT need to take your hands off the keyboard to pick colors. Getting

Dec 27, 2022

Tpf2-tpnetmap-toolkit - A toolkit to create svg map images from TransportFever2 world data

Tpf2-tpnetmap-toolkit - A toolkit to create svg map images from TransportFever2 world data

tpf2-tpnetmap-toolkit TransportFever2 のワールドデータから svg のマップ画像を作成するツールキットです。 1. 導入方

Feb 17, 2022

Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

GIT-PIPE Hassle-free minimal CI/CD for git repos for docker-based projects. Features: zero configuration for repos by default automatic encrypted back

Sep 23, 2022
Comments
  • try to use it but go get failed

    try to use it but go get failed

    I understand it is a work in progress. I just wanted to let you know that go get github.com/spearson78/tinygui/component was not successful. (side note: on which micro controller do you test?)

    ➜ go get github.com/spearson78/tinygui/component
    go: downloading tinygo.org/x/tinydraw v0.0.0-20220125063109-43cae6615eb5
    # github.com/spearson78/tinygui/primitive
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:14:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:15:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:16:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:17:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:22:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:23:2: undefined: tinydraw.FilledRectangleEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:24:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:30:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:31:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:37:2: undefined: tinydraw.LineEx
    /Users/thierry/go/pkg/mod/github.com/spearson78/[email protected]/primitive/primitives.go:37:2: too many errors
    
    
Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.
Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.

XCGUI 项目文档 帮助文档 程序示例 介绍 English | 简体中文 DirectUI设计思想: 在窗口内没有子窗口,界面元素都是逻辑上的区域(无HWND句柄,安全,灵活), 所有UI元素都是自主开发(不受系统限制), 更加灵活的实现各种程序界面,满足不同用户的需求.

Dec 22, 2022
Super minimal, rock-solid foundation for concurrent GUI in Go.
Super minimal, rock-solid foundation for concurrent GUI in Go.

faiface/gui Super minimal, rock-solid foundation for concurrent GUI in Go. Installation go get -u github.com/faiface/gui Currently uses GLFW under th

Dec 23, 2022
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Dear ImGui (This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addit

Dec 31, 2022
A Windows GUI toolkit for the Go Programming Language
A Windows GUI toolkit for the Go Programming Language

About Walk Walk is a "Windows Application Library Kit" for the Go Programming Language. Its primarily useful for Desktop GUI development, but there is

Dec 30, 2022
Go Web UI Toolkit - Public Releases and Development
 Go Web UI Toolkit - Public Releases and Development

Welcome! Gowut (Go Web UI Toolkit) is a full-featured, easy to use, platform independent Web UI Toolkit written in pure Go, no platform dependent nati

Dec 5, 2022
pure go, cross-platform, MIT-licensed ui toolkit for developers
pure go, cross-platform, MIT-licensed ui toolkit for developers

duit - developer ui toolkit WARNING: this library is work in progress. backwards incompatible changes will be made. details duit is a pure go (*), cro

Dec 24, 2022
GUI toolkit for go
GUI toolkit for go

Mostly-immediate-mode GUI library for Go. Source port to go of an early version of nuklear. ⚠️ Subject to backwards incompatible changes. ⚠️ ⚠️ Featur

Jan 1, 2023
A unified graphical user experience toolkit for Go desktop applications

Unison A unified graphical user experience toolkit for Go desktop applications. macOS, Windows, and Linux are supported. Required setup Unison is buil

Dec 20, 2022
Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase
Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase. Inspired by Flutter, React. S

Apr 18, 2022
UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase
 UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

Apr 18, 2022