This Go package provides a framework for rapidly building interactive data dashboards and web applications. It aims to offer a similar development experience to Streamlit for Python users.
Warning
The API for this package is still under development, and may be subject to changes in the future.
Documentation: https://voilelab.github.io/toolgui/, built from
docs/. It tracks the latest release; docs/ on dev is ahead of it.
package main
import (
"log"
"github.com/voilelab/toolgui/toolgui/tgcomp"
"github.com/voilelab/toolgui/toolgui/tgexec"
"github.com/voilelab/toolgui/toolgui/tgframe"
)
func Main(p *tgframe.Params) error {
name := tgcomp.Textbox(p.Sidebar, "What's your name?")
if name != "" {
tgcomp.Text(p.Sidebar, "Hi "+name+"~")
}
tgcomp.Text(p.Main, "hello ")
if tgcomp.Button(p.Main, "keep going") {
tgcomp.Text(p.Main, "world")
}
return nil
}
func main() {
app := tgframe.NewApp()
app.AddPage("index", "Index", Main)
e := tgexec.NewWebExecutor(app)
log.Println("Starting service...")
e.StartService(":3000")
}task run_democmd/toolgui-todo is a smaller example, a todo list built on the state:
task run_todotask run_democd toolgui-e2e
cypress e2e:chrome
cypress e2e:firefoxtoolgui-wails is a separate Go module that runs the same app in a desktop
window with Wails v2. It needs GTK and WebKit, which is why it stays out of the
main module. See toolgui-wails/README.md.
task run_wails_hellotoolgui/tgwasm runs the same app in the browser, compiled to js/wasm, with
no server behind it. cmd/toolgui-wasm builds the static site around it, and
the component demo is published from
it. See
toolgui/tgwasm/README.md.
task run_wasm_hello # the small example
task run_wasm_demo # the component demo, in the browsertoolgui-web/web.go and toolgui-wails/assets.go embed build output that is
not committed on dev. To compile Go code without running a frontend build:
task stub_assets
go build ./...Releases are cut by the Release GitHub Action (Actions → Release → Run workflow), with a vX.Y.Z version as input. It builds the web assets from
dev, commits them, tags, and pushes.
go get resolves tags, so the tagged commit is what has to carry
toolgui-web/app/build — that is the only reason the built assets live in git
at all. main is a CI-owned mirror of the latest release commit; do not commit
to it by hand.