Hi Gophers!
I’d like to share dxui, an open-source, MIT-licensed framework for building desktop UIs in Go for macOS, Windows, and Linux.
With dxui, you describe your interface in Go using typed props and callbacks. Application state stays in your own Go code: callbacks update it, and dxui rebuilds and reconciles the view description.
- GitHub: https://github.com/dxui-org/dxui
- Documentation: https://dxui-org.github.io
What it offers
- Build without cgo: both the framework and application builds support
CGO_ENABLED=0. - Small footprint: in my measurements, the hello-dxui example produces a 7 MB binary and uses 22 MB of memory. Results may vary by platform, build configuration, and application complexity.
- Declarative UI in Go: compose layouts and controls using Go types, functions, and callbacks.
- On-demand rendering: an event- and deadline-driven loop waits when idle.
- Everyday controls: inputs, buttons, selects, menus, tabs, overlays, and more.
- Styling and themes: typed theme tokens, runtime light/dark switching, rounded corners, shadows, and interaction states.
- Multiple windows and long lists: independent native child windows and a keyed, fixed-height virtual list.
Try it
git clone https://github.com/dxui-org/dxui.git
cd dxui
go run ./examples/components
The component catalog lets you explore controls, change their properties, and switch themes. For smaller examples, try the calculator or login form:
go run ./examples/calc
go run ./examples/login
There are also examples for multiple windows, text rendering, layouts, and a virtual list with 100,000 fixed-height rows.
What the code looks like
Here’s a complete greeting form:
package main
import (
"log"
"github.com/dxui-org/dxui"
)
func main() {
app := dxui.NewApp(dxui.AppOptions{
Title: "Hello dxui", Width: 480, Height: 240,
})
name := ""
root := func() dxui.View {
return dxui.Box(dxui.BoxProps{
Style: dxui.Style{Padding: dxui.Padding(24)},
Gap: 12,
},
dxui.Label("What is your name?"),
dxui.Input(dxui.InputProps{
Key: "name", Value: name, Placeholder: "Your name",
OnChange: dxui.Assign(&name),
}),
dxui.Label("Hello, " + name + "!"),
dxui.TextButton(dxui.ButtonProps{OnPress: app.Close}, "Close"),
)
}
if err := app.Run(root); err != nil {
log.Fatal(err)
}
}
To run this separately, create a new directory, run go mod init example.com/hello-dxui and go get github.com/dxui-org/dxui, then save the code as main.go and run go run ..
I’d love feedback from other Go developers, especially on the API and your experience running the examples on different operating systems. What would you need from dxui before considering it for a desktop project?
If you encounter a rendering or input issue, please include your OS/architecture, Go version, and a small reproduction in a github issue.
Thanks for taking a look!
