Recursive AI
oneuiGoAvailable

oneui for Go

A free, open-source UI component library for Go, MIT or Apache-2.0. A component is an HTML template, optional scoped CSS and a Go struct; go generate compiles it into plain Go that updates only the nodes bound to state that changed.

Render it to HTML, run it in the browser with WebAssembly, or test it without a browser. No dependencies: its go.mod requires nothing.

go get recursiveai.org/go/oneui@v1.0.1

Quick start

The README’s quick start, run with Go 1.26.8 against v1.0.1 from the module proxy. go generate writes SetCount and the code that rewrites only the button’s text when Count changes.

Tests, lists and the browser
Hello.htmlHTML
<button on:click="Increment">Clicked {Count} times</button>
main.goGo
package main
 
//go:generate go run recursiveai.org/go/oneui/cmd/oneui generate
 
import (
    "os"
 
    "recursiveai.org/go/oneui"
)
 
type Hello struct {
    oneui.Base
    Count int `oneui:"state"`
}
 
func (h *Hello) Increment() { h.SetCount(h.Count + 1) }
 
func main() {
    h := &Hello{}
    h.Increment()
    oneui.RenderHTML(os.Stdout, h)
}
Shellsh
go mod init example.com/hello
go get recursiveai.org/go/oneui@v1.0.1
go generate ./...
go run .
OutputGo 1.26.8
<button>Clicked 1 times</button>

Fixed in 1.0.1

Speed

The repository’s benchmark: a list of 1,000 rows written three ways, each checked to produce the same markup first. Median time per operation of six counts on an AMD Ryzen 9 7950X3D with Go 1.26.8 on Linux.

What each row measures
Rowoneuitemplgo-app
Render to HTML28.3 µs537 µs1.11 ms
Mount to change set, cold736 µsnot a job templ doestree build 687 µs
Update one row, live (change set)13.9 µsno live updatewasm only
Update one row, server-side re-render29.1 µs471 µs1.08 ms (render function only)
Update every row, server-side re-render29.5 µs500 µs1.18 ms

Mounting a cold context to a change set takes 736 µs against go-app’s element-tree build at 687 µs, 7% slower, with 38% fewer allocations; warm (a long-lived context) it is 575 µs, ahead.

bench/RESULTS.md at v1.0.1

What it does