Thursday, September 24, 2026
HomeGolangDxui: A declarative desktop GUI framework for Go, with out cgo -...

Dxui: A declarative desktop GUI framework for Go, with out cgo – Releases


Hello Gophers!

I’d wish to share dxui, an open-source, MIT-licensed framework for constructing desktop UIs in Go for macOS, Home windows, and Linux.

With dxui, you describe your interface in Go utilizing typed props and callbacks. Utility state stays in your individual Go code: callbacks replace it, and dxui rebuilds and reconciles the view description.

What it presents

  • Construct with out cgo: each the framework and utility builds assist CGO_ENABLED=0.
  • Small footprint: in my measurements, the hello-dxui instance produces a 7 MB binary and makes use of 22 MB of reminiscence. Outcomes could differ by platform, construct configuration, and utility complexity.
  • Declarative UI in Go: compose layouts and controls utilizing Go varieties, features, and callbacks.
  • On-demand rendering: an event- and deadline-driven loop waits when idle.
  • On a regular basis controls: inputs, buttons, selects, menus, tabs, overlays, and extra.
  • Styling and themes: typed theme tokens, runtime gentle/darkish switching, rounded corners, shadows, and interplay states.
  • A number of home windows and lengthy lists: impartial native little one home windows and a keyed, fixed-height digital record.

Attempt it

git clone https://github.com/dxui-org/dxui.git
cd dxui
go run ./examples/parts

The part catalog helps you to discover controls, change their properties, and swap themes. For smaller examples, strive the calculator or login type:

go run ./examples/calc
go run ./examples/login

There are additionally examples for a number of home windows, textual content rendering, layouts, and a digital record with 100,000 fixed-height rows.

What the code seems to be like

Right here’s a whole greeting type:

bundle important

import (
	"log"

	"github.com/dxui-org/dxui"
)

func important() {
	app := dxui.NewApp(dxui.AppOptions{
		Title: "Hey dxui", Width: 480, Peak: 240,
	})
	identify := ""

	root := func() dxui.View {
		return dxui.Field(dxui.BoxProps{
			Fashion: dxui.Fashion{Padding: dxui.Padding(24)},
			Hole:   12,
		},
			dxui.Label("What's your identify?"),
			dxui.Enter(dxui.InputProps{
				Key: "identify", Worth: identify, Placeholder: "Your identify",
				OnChange: dxui.Assign(&identify),
			}),
			dxui.Label("Hey, " + identify + "!"),
			dxui.TextButton(dxui.ButtonProps{OnPress: app.Shut}, "Shut"),
		)
	}

	if err := app.Run(root); err != nil {
		log.Deadly(err)
	}
}

To run this individually, create a brand new listing, run go mod init instance.com/hello-dxui and go get github.com/dxui-org/dxui, then save the code as important.go and run go run ..

I’d love suggestions from different Go builders, particularly on the API and your expertise operating the examples on completely different working programs. What would you want from dxui earlier than contemplating it for a desktop undertaking?

When you encounter a rendering or enter situation, please embody your OS/structure, Go model, and a small copy in a github situation.

Thanks for having a look!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments