Skip to content

Getting Started

#Requirements

  • macOS 14 or later
  • Go 1.23 or later
  • Bun 1.4 or later
  • Xcode Command Line Tools (xcode-select --install)

macOS is the supported target today.

#Create a project

bunx @quickgui/cli init my-app --language go
cd my-app
quickgui dev

init writes the project and installs dependencies. Omit --language to choose Go, TypeScript, or Rust interactively.

#Your first window

main.go starts the app with native.Run and opens a window. Pass a component function to WindowOptions.Component. The component returns the UI for that window.

package main

import (
	"log"

	"github.com/egoist/quickgui/go/native"
	"github.com/egoist/quickgui/go/ui"
)

func Counter() *ui.Element {
	count, setCount := ui.CreateSignal(0)
	return ui.View().
		FlexCol().
		SizeFull().
		ItemsCenter().
		JustifyCenter().
		Gap(20).
		Bg("#090d16").
		TextColor("#e2e8f0").
		Child(ui.Text("Count: ", count()).FontSize(28).FontWeight(700)).
		Child(ui.Button().
			OnClick(func() { setCount(count() + 1) }).
			Padding(12).
			RoundedLg().
			Bg("#2563eb").
			Hover(func(s ui.StyleBuilder) ui.StyleBuilder { return s.BackgroundColor("#3b82f6") }).
			Child("Increment"))
}

func main() {
	if err := native.Run(func() {
		open := func() {
			native.NewWindow(native.WindowOptions{
				Title:     "My App",
				Width:     720,
				Height:    480,
				Component: Counter,
			})
		}
		native.App.OnReopen(func(event native.ReopenEvent) {
			if !event.HasVisibleWindows {
				open()
			}
		})
		open()
	}); err != nil {
		log.Fatal(err)
	}
}

OnReopen opens a window again when the user clicks the Dock icon and none are visible.

#Run and build

quickgui dev
quickgui fmt
quickgui check
quickgui build

dev rebuilds your Go code and relaunches the app as you edit. fmt wraps long UI calls. build writes a packaged app under dist/.

#Next steps