goi
A declarative GUI framework for Go, rendered with WebGPU.
goi describes a window in .goi files: elements, properties, ids, if/else
and for loops. Go finds elements by id, holds the state and attaches the
behaviour. Edit a .goi file and the window updates without a restart: hot
reload is built in.
bridge {
Count int
onInc func()
}
Window {
title: "Counter"
Column {
padding: 24
spacing: 16
crossAxisAlign: center
Text {
text: formatf("%d", bridge.Count)
role: displayLarge
}
Button {
id: inc
label: "+"
onClick: bridge.onInc()
}
}
}
var count int // outside Bind: Bind runs again after every hot reload
func main() {
app, _ := ui.NewApp()
win, _ := app.LoadWindowFile("counter.goi", ui.WithHotReload(true))
win.Bind(func(w *ui.Window) error {
ui.SetData(w, "Count", count)
return ui.SetHandler(w, "onInc", func() {
count++
ui.SetData(w, "Count", count)
})
})
app.Run()
}
SetData feeds bridge.Count; SetHandler supplies the body a bridge call
runs. The label follows the value without a manual repaint.
Start here
- .goi syntax — the language reference: declarations, imports, props, slots and literals.
- Conditionals, loops — showing an arm or repeating elements.
- Bridge — passing values and handlers from Go.
- Fragments — splitting a design across files with props, children and named slots.
- Components — every element, grouped by purpose, with a
.goiexample and its properties. - Icons — every Material Symbols name the renderer can draw.
- Zed extension — highlighting, completion and
diagnostics for
.goifiles.
Install
go get github.com/goi-gui/goi/ui
The WebGPU renderer and the SDL3 window layer live behind the ui package.
Only ui is imported by an application.