One Go codebase.
Desktop and web.
Yoga is a from-scratch UI framework in Go. It draws with WebGPU, natively on the desktop and from WebAssembly in the browser, and lays out with a pure-Go flex, grid and stack engine.
25 themes in the box, every one checked against WCAG 2.1 AA
Your state in a struct.
Your UI, rebuilt every frame.
An app is a Go struct with one method, Body(c *ui.Ctx) ui.View. Yoga calls it on every drawn frame and lays out what it returns, so the screen always matches your data.
Plain Go state
Durable state lives on your app struct. Hover, caret, scroll and open menus live in the framework, keyed by a stable id.
Idle means idle
The event loop sleeps until input or an animation request, so an idle window costs close to no CPU.
One tree, three hosts
The same Body runs in a desktop window, in the browser, and headless in your tests.
Controlled widgets
Pass the value in, take changes back in a callback. No two-way binding to reason about.
A window is a dozen lines.
type App struct{ name string }
func (a *App) Body(c *ui.Ctx) ui.View {
th := c.Theme()
return ui.Column(
ui.Title("Hello"),
ui.TextField("name", a.name).
Placeholder("Your name").
OnChange(func(s string) { a.name = s }).
DefaultFocus(),
ui.Button("ok", ui.Text("OK")).Primary().OnClick(a.save),
).Gap(th.Spacing.M).Padding(th.Spacing.L).Grow(1).Background(ui.TokenSurface)
}
func main() {
yoga.Run(yoga.Config{Title: "Hello", Width: 640, Height: 480},
func() *App { return &App{} })
}t := theme.FromPalette(theme.Palette{
Name: "acme-dark", Dark: true,
Neutral: theme.Ramp{ /* 12 colors, darkest to lightest */ },
Accent: render.RGBA8(53, 103, 214, 255),
Error: render.RGBA8(229, 72, 77, 255),
Warning: render.RGBA8(245, 185, 74, 255),
Success: render.RGBA8(70, 184, 100, 255),
})
theme.Register(t)
theme.Use("acme-dark") // the next paint uses it; nothing rebuildsname = "Todos"
id = "com.example.todo"
version = "0.1.0"
icon = "assets/icon.png"
artifact = "todos-{platform}-v{version}-{arch}"
[darwin]
formats = ["dmg", "pkg"]
min_system = "13.0"
[linux]
format = "tar.xz"
[windows]
company = "Example"Everything an app needs,
drawn by Yoga.
Layout, widgets, overlays, themes and icons, written in Go above a thin platform host. Nothing is handed to a browser engine or to native widgets.
Widgets that keep up
Stateless DSL nodes for the simple parts, retained widgets for the ones that keep real state: tables with editable cells, trees, file trees and virtualized lists.
WebGPU everywhere
GLFW and wgpu-native on the desktop, the browser's WebGPU from WebAssembly. Everything above the host is pure Go.
Flex, grid and stack
Column, Row, Grid, Stack and Scroll, with gap, padding, grow, align and floating corners.
Text fields that help
Highlight ranges of a field's value, offer completions under it, and explain what the pointer rests on.
Custom title bars
Put menus and search in the title bar. macOS keeps its traffic lights; Windows and Linux get drawn controls.
Command palette & shortcuts
Register commands with key chords, including two-chord sequences, and get a fuzzy palette for free.
Forms and dialogs
Settings rows with switches, selects, numbers and file pickers; info, danger and input dialogs; toasts; a pure-Go file dialog.
Accessible themes
Contrast is tested, high-contrast and colorblind-safe palettes ship, and FromPalette builds a passing theme from your brand colors.
Lucide icons
Pre-rasterized Lucide symbols, dropped by the linker when unused, plus your own SVGs.
A code editor, if you want one
yogaui/editor adds Tree-sitter highlighting, language servers, folding and multiple cursors.
Real apps, not demos.
Yoga is the UI of two shipping desktop apps, and the framework grows with what they need.
Hm
A native code editor with an AI coding agent built in: file tree, tabs, a terminal, git, language servers and a chat pane, all drawn by Yoga.
- Every editor pane is a
yogaui/editorEditor. - Settings are Yoga forms; the command palette is Yoga's.
Chapar
An API client for HTTP, gRPC and WebSockets: request trees, environments, editable tables of headers and variables, and response viewers.
- Template variables are highlighted, completed and explained in Yoga text fields.
- Packaged for macOS, Linux and Windows with the
yogaCLI.
One CLI for every platform.
The yoga tool builds and packages your app, configured by an optional yoga.toml.
- macOS: a signed
.app, DMG or PKG, universal binaries, notarization. - Linux:
tar.gzortar.xz, plus an AppImage whenappimagetoolis installed. - Windows: a portable zip with an icon, DPI manifest and version info.
- The web: a static folder you can host anywhere.
# Desktop: .app + DMG, AppImage, a Windows zip
yoga package -os darwin -arch universal -notarize ./cmd/app
yoga package -os linux ./cmd/app
yoga package -os windows ./cmd/app
# The browser: index.html, app.wasm and a loader
yoga package -os web ./cmd/app
yoga serve # serves ./dist/web
# CI: same UI pipeline, no window or GPU
go test -tags nogpu ./...Build something native.
Go 1.26 or newer. Desktop builds need Cgo; the browser and headless builds do not.
go get github.com/yogaui/yoga